Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: What's wrong with cumtrapz?
Posted:
Jun 17, 2013 10:52 AM


"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 nonvector) 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



