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: plot problem
Replies: 6   Last Post: Dec 2, 2012 11:21 AM

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: plot problem
Posted: Dec 2, 2012 11:21 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Thanks a lot for explanations. I have tried my own code to plot the bifurcation diagram but still have one problem

% define the vector of colors, to plot the dat aof reach value of r in
% different color
color_vec = ['b'];
for rho = 0: 0.001:10

% do a loop of values of r
for j = 1 : size(r_vec,2)
% define delay
r = r_vec(j);
% define coefficient rho
%rho = 0.5;
% define the number of deiscrete times in interval [k*r, (k+1)*r]
n = 50;
% define the nimber of iterations k = 1,.....,Nit
Nit = 300;
% 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_previous = zeros(1,n); %x_n
x_pp=zeros(1,n); %x_n-1
x_ppp=zeros(1,n); %x_n-2
x_pppp=zeros(1,n); %x_n-3
time = zeros(1,n);

% initialize x_previous
x_previous = x0;
x_pp=0.2*ones(1,n); %x_n-1
x_ppp=0.1*ones(1,n); %x_n-2
x_pppp=0.4*ones(1,n); %x_n-3
time = zeros(1,n);
%x_next = x_previous;
time = linspace(0,r,n);

hold on
for i = 1:Nit
time = linspace(i*r,(i+1)*r,Nit);
x_next = x_previous+(time(i)-i.*r_vec(j))*rho*x_pppp.*(1-x_ppp);
x_previous = x_next;
plot(rho,x_next(1),'.', 'Color', char(color_vec(j)))


I always get a straight line. What went wrong please?
Thanks a lot for your help. I really appreciate it.

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.