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: problem with cumtrapz
Replies: 3   Last Post: Dec 8, 2012 1:09 PM

Advanced Search

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

Posts: 171
Registered: 3/20/12
Re: problem with cumtrapz
Posted: Dec 8, 2012 1:09 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I am sorry for the miss forming of the code. Please see this
% define the vector of colors, to plot the data of reach value of r in
% different color
color_vec = ['b'];
for rho = 0: 0.001:10
% define the number of discrete times in interval [k*r, (k+1)*r]
n = 50;
% define the number of iterations k = 1,.....,Nit
Nit = 150;
% define the initial vector which is a vector of size n
x0 = 0.3*ones(1,n);
% define vectors x_next and x_previous
x_next = zeros(1,n); %x_(n+1)
x_previous = zeros(1,n); %x_n
time = zeros(1,n);
% initialize x_previous
x_previous = x0;
x_next = x_previous;
hold on
for i = 1:Nit
time = linspace(i*r,(i+1)*r,Nit);
x_next = x_previous+ cumtrapz(y_next);
x_previous = x_next;
plot(rho,x_next(1),'.', 'Color', char(color_vec))
Now I have only one point in the plot!! I also want to integrate from n*r to t!?
Any help please.
thanks a lot in advance

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.