Help! Bifurcation diagram for difference equation
Mostrar comentarios más antiguos
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 comentarios
darova
el 12 de Abr. de 2020
I don't understand the question. I run your code and got this:

Can you exaplain more? Maybe a simple sketch or simething?
Carolina Biliotti
el 12 de Abr. de 2020
darova
el 12 de Abr. de 2020
Can you attach your original eqaations?
I have somer problem with the link you gave

Carolina Biliotti
el 12 de Abr. de 2020
Carolina Biliotti
el 12 de Abr. de 2020
darova
el 12 de Abr. de 2020
There is too much text! I understand this: you have diff equation and want to draw something
Where is the diff equation? Can you show? What needs to be done to draw bifurcation diagram?
Carolina Biliotti
el 12 de Abr. de 2020
darova
el 12 de Abr. de 2020
Try to change lambda value

Don't forget about limits
set(gca, 'xlim', [0 5], 'ylim', [1.5 4.5]);
Respuestas (0)
Categorías
Más información sobre Assembly en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
