problem using trapz function

조회 수: 7 (최근 30일)
Al Thr
Al Thr 2017년 4월 28일
댓글: Star Strider 2017년 4월 28일
can someone help me figure out how to use the trapz function to find the area under the curve for a graph of for example Y=[1 3 5 9 15] versus t =[0 14 28 35 42] respectively? over the time intervals 0-14,14-28,28-35,35-42. to clarify i'm wondering how one specifies in the trapz funtion to take the area under the curve of a matrix over variable intervals. I've tried trapz(t,Y) but it doesn't work. any help would be greatly appreciated.

답변 (1개)

Star Strider
Star Strider 2017년 4월 28일
See if the cumtrapz function does what you want:
z = cumtrapz(t,Y)
It takes the cumulative integrals over each ‘t’ interval.
  댓글 수: 2
Al Thr
Al Thr 2017년 4월 28일
it didn't change anything. got any other ideas?
Star Strider
Star Strider 2017년 4월 28일
I have no idea what you want.
Try this:
zx = diff(z)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by