PWLINT: Piecewise Linear Integration

version (1.73 KB) by Andrew Davis
Return positive and negative areas, assuming a piecewise linear function


Updated 26 Jan 2012

View License

Calculate the positive and negative area under a curve
using trapezoids, assuming a piecewise linear function

Requires insertrows:

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

Cite As

Andrew Davis (2022). PWLINT: Piecewise Linear Integration (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: insertrows

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!