Help! Bifurcation diagram for difference equation
이전 댓글 표시
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
darova
2020년 4월 12일
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
2020년 4월 12일
darova
2020년 4월 12일
Can you attach your original eqaations?
I have somer problem with the link you gave

Carolina Biliotti
2020년 4월 12일
Carolina Biliotti
2020년 4월 12일
darova
2020년 4월 12일
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
2020년 4월 12일
darova
2020년 4월 12일
Try to change lambda value

Don't forget about limits
set(gca, 'xlim', [0 5], 'ylim', [1.5 4.5]);
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Assembly에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
