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: 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 ]
Sanaa

Posts: 168
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'];
r=0.05;
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;
end
end
plot(rho,x_next(1),'.', 'Color', char(color_vec(j)))

end

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]

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