Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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 ]
Steven Lord

Posts: 17,944
Registered: 12/7/04
Re: What's wrong with cumtrapz?
Posted: Jun 17, 2013 10:52 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply



"Yuji Zhang" <yuji.zhang@tufts.edu> wrote in message
news:kpkfsc$6r9$1@newscl01ah.mathworks.com...
> Hi Bruno~
>
> Thanks for getting back to me.
>
> I see. I assumed they were same.
>
> What do you mean by "(array non-vector) if it important their
> orientation"?


http://www.mathworks.com/help/matlab/ref/cumtrapz.html

Read the second sentence of this snippet from the documentation:

"Z = cumtrapz(X,Y) computes the cumulative integral of Y with respect to X
using trapezoidal integration. X and Y must be vectors of the same length,
or X must be a column vector and Y an array whose first nonsingleton
dimension is length(X). cumtrapz operates across this dimension. Inputs X
and Y can be complex."


% This works; for vectors, orientation doesn't matter
cumtrapz(1:3, (4:6).')

% This works, since the first nonsingleton dimension of the second input is
3 which is the length of the first input
cumtrapz([1; 2; 3], ones(3, 4))

% This does NOT work, even though the second input is just the transpose of
the second input from the previous example
cumtrapz([1; 2; 3], ones(4, 3))


--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com




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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.