why you wanna use cumtrapz(x',y') instead of cumtrapz(x,y) ? they're the same right?
Let me know. Thank you~
Nabeel <firstname.lastname@example.org> wrote in message <3AF23058.E8745FEB@mathworks.com>... > Hi, > > Running this code: > > x = 0:pi/100:4*pi; > y = sin( 2*pi*x); > inty = cumtrapz(x',y'); > plot(x,y,x,inty) > > produces a plot that looks right to me. You wrote: > > > I would expect a COS(X) time trace after CUMTRAPZ. The integrated > > time trace gave a cos pattern of variation, correct amplitude BUT was > > wrong in phase and shifted upwards, i.e. it is greater than zero for all > > x and gives 0, rather than 1, at x = 0. I am very confused with the > > results. > > CUMTRAPZ is the cumulative integral, or the running sum of the area > under the curve. From the graph above, you can see that the running sum > of the area is never negative, at the lowest it's zero. As for the > value at x=0, there's no area under the curve yet, so the value of 0 is > correct. > > If you work it out by hand, you'll should be able to verify the results. > > -- Nabeel