Help! Bifurcation diagram for difference equation

14 views (last 30 days)
Hello everyone! I need help figuring out how to plot a bifurcation diagram when dealing with difference equations. I tried following the indications on the page http://www.math.le.ac.uk/people/rld8/ma1251/lab3.html, but I cannot figure out what I'm doing wrong. This is what I wrote:
clear all;
close all;
Npre=100;
Nplot=200;
x = zeros(Nplot,1);
for lambda = 0:0.01:5
x(1) = 2.95;
x(2)=x(1)+0.2;
x(3)=x(1)-0.2;
for i = 3:Npre
% x(i+3) = x(i+2)+0.19*100*(0.5*0.3*(3-x(i+2))-0.5*0.5*(x(i+2)-3))./(1+exp(-lambda*(2.1*((1/3)-0.01)+15*((x(i+1)-x(i))./x(i)))));
x(3)=x(3)+0.19*100*(0.5*0.3*(3-x(3))-0.5*0.5*(x(3)-3))./(1+exp(-lambda*(2.1*((1/3)-0.01)+15*((x(2)-x(1))./x(1)))));
end
for i = 1:Nplot-3
x(i+3) = x(i+2)+0.19*100*(0.5*0.3*(3-x(i+2))-0.5*0.5*(x(i+2)-3))./(1+exp(-lambda*(2.1*((1/3)-0.01)+15*((x(i+1)-x(i))./x(i)))));
end
plot(lambda*ones(Nplot,1), x, '.', 'markersize', 2);
hold on;
end
title('Bifurcation diagram');
xlabel('lambda'); ylabel('x_i');
set(gca, 'xlim', [0 5], 'ylim', [1.5 4.5]);
hold off;
  8 Comments
Carolina Biliotti
Carolina Biliotti on 12 Apr 2020
This is the difference equation:
x(i+3)=x(i+2)+gamma*Num*((w*gf*(F-x(i+2))+(1-w)*gc*(x(i+2)-F))./(1+exp(-lambda*(alpha*((D/F)-r)+beta*((x(i+1)-x(i))./x(i))))))
As I understood correctly, to draw a bifurcation diagram we need to create a loop to show the values approached asymptotically of some system of equations or map as a function of a bifurcation-changing parameter (lambda, in my case). The solid line in the picture I attached are the stable values of the system (so the system is stable until lambda approaches lambda_T). After lambda_t the system becomes unstable, first through period-doubling bifurcations, then reaching chaotic behavior.
Thank you again for your help.
darova
darova on 12 Apr 2020
Try to change lambda value
Don't forget about limits
set(gca, 'xlim', [0 5], 'ylim', [1.5 4.5]);

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!