Calculate the positive and negative area under a curve
using trapezoids, assuming a piecewise linear function
Inspired by this thread:
[Apos, Aneg, Anet] = pwlint(x,y)
x: vector of independent variable
y: vector of dependent variable
Apos: area between y=0 and positive y values
Aneg: area between y=0 and negative y values
Anet: Apos+Aneg; equal to trapz(x,y)
See also TRAPZ, SUM
Andrew Davis (2022). PWLINT: Piecewise Linear Integration (https://www.mathworks.com/matlabcentral/fileexchange/34787-pwlint-piecewise-linear-integration), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Inspired by: insertrows
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!