The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: What's wrong with cumtrapz?
Replies: 7   Last Post: Jun 17, 2013 10:52 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 30
Registered: 6/27/11
Re: What's wrong with cumtrapz?
Posted: Jun 16, 2013 1:35 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi~ I've a question - maybe trivial.

why you wanna use cumtrapz(x',y') instead of cumtrapz(x,y) ? they're the same right?

Let me know. Thank you~

Nabeel <> wrote in message <>...
> 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

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.