how to plot bifurcation graph

4 views (last 30 days)
shiv gaur
shiv gaur on 20 Nov 2022
Answered: William Rose on 20 Nov 2022
this the program of rossler we want to vary value b from 0 to 2
Tstart = 0.0;
Tend = 1000.0;
Nt = 20000;
dT = (Tend-Tstart)/Nt;
X0 = 0.0;
Y0 = 1.0;
Z0 = 0.0;
N = 20;
// Initialize coefficient arrays
T = zeros(Nt+1,1);
X = zeros(Nt+1,1);
Y = zeros(Nt+1,1);
Z = zeros(Nt+1,1);
a = zeros(N+1,1);
b = zeros(N+1,1);
c = zeros(N+1,1);
T(1) = 0.0;
X(1) = X0;
Y(1) = Y0;
Z(1) = Z0;
for j = 2:Nt+1
a(1) = X(j-1);
b(1) = Y(j-1);
c(1) = Z(j-1);
for k = 1:N
SC = 0.0;
for i= 0:k-1
SC = SC+ a(i+1)*c(k-i);
a(k+1) = (-b(k) - c(k))/k;
b(k+1) = (a(k)+A*b(k))/k ;
c(k+1) = (SC+B-C*(c(k)))/k ;
x = a(1);
y = b(1);
z = c(1);
for k = 2:N+1
x = x + a(k)*dT^(k-1);
y = y + b(k)*dT^(k-1);
z = z + c(k)*dT^(k-1);
%Prepare for T = T + dT
T(j) = T(j-1) + dT;
X(j) = x;
Y(j) = y;
Z(j) = z;
the value of b vary from 0 to 2 plot the graph b vs x this the program of power series rossler
  1 Comment
shiv gaur
shiv gaur on 20 Nov 2022
pl help to plot bifur b vs x

Sign in to comment.

Answers (1)

William Rose
William Rose on 20 Nov 2022
I do not understand what you are bdoing with a(), b(), and c() inside the main loop (the loop "for j=2:Nt+1, ..., end"). For example, you have the inner loop
for k = 2:N+1
x = x + a(k)*dT^(k-1);
y = y + b(k)*dT^(k-1);
z = z + c(k)*dT^(k-1);
where N=20. Why do you want to do any calcuations involving the 20th power of dT?
Add an outer loop that varies B over the desired range. For each value of B, I recommend that you use ode45() to solve the differential equations, since ode45() is much faster and more accurate that the forward Euler method which you appear to use. AFter solving the system with ode45(), use findpeaks(x) and findpeaks (-x) to find the maximum and minimum values of x during the final 200 seconds or 500 seconds or some appropriate time range. You will probably experiment to determine the appropriate time range to use with findpeaks(). Plot the minimum and maximum values of x, which you will have found with findpeaks(), versus the parameter B. If there are B values for which x approaches a steady state, then findpeaks() will not find any peaks. In such a situaiton, just find, and plot, the steady state value of X, versus the corresponding B value.
Good luck!





Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by