Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Plotting bifurcation diagram

Subject: Plotting bifurcation diagram

From: Sanaa

Date: 30 Jan, 2013 14:10:11

Message: 1 of 1

Hi,

I am plotting the bifurcation diagram for the map
x_(n+1)= x_n + (t-n*r)+ rho* x_n*(1-x_(n-1)), n=0,1,2,...,
t is the time should be between n*r and (n+1)*r.
What's wrong in the code! I should have got a diagram not a point!!!

% define the vector of colors, to plot the dat aof reach value of r in
% different color
color_vec = ['b'];
r=0.5;
for rho = 0: 0.001:4
% define the number of deiscrete times in interval [k*r, (k+1)*r]
n = 10;
% define the nimber of iterations k = 1,.....,Nit
Nit = 50;
% 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
time = zeros(1,n);

% initialize x_previous
%x_previous = x0;
x_pp=0.2*ones(1,n); %x_n-1
   
    hold on
for i = 1:Nit
    time = linspace(i*r,(i+1)*r,Nit);
    x_next = x_previous+(time(i)-i.*r)*rho*x_pp.*(1-x_pp);
    %x_previous = x_next;
 end
end
      plot(rho,x_next(1),'b.')
     
   I need your help if you please.
Thanks a lot in advance.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us