Be the first to rate this file! 5 Downloads (last 30 days) File Size: 1.73 KB File ID: #34787
image thumbnail

PWLINT: Piecewise Linear Integration

by Andrew Davis

 

26 Jan 2012

Return positive and negative areas, assuming a piecewise linear function

| Watch this File

File Information
Description

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

Requires insertrows:
  http://www.mathworks.com/matlabcentral/fileexchange/9984

Inspired by this thread:
  http://www.mathworks.com/matlabcentral/newsreader/view_thread/252131

Usage:
  [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

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
INSERTROWS (v2.0, may 2008)

Required Products MATLAB
MATLAB release MATLAB 7.12 (2011a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
signal processing Andrew Davis 26 Jan 2012 10:08:49
mathematics Andrew Davis 26 Jan 2012 10:08:49
numerical Andrew Davis 02 Mar 2012 20:02:42
integration Andrew Davis 02 Mar 2012 20:02:47
trapezoid Andrew Davis 02 Mar 2012 20:02:55

Contact us at files@mathworks.com