Plot doesn't show anything
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Duc Anh Le
le 8 Déc 2019
Réponse apportée : Star Strider
le 8 Déc 2019
I'm trying to plot the orbit diagram of the logistic map, but the plot doesn't show anything. There are no error messages, so I'm stuck...
close;
clear;
orbit=zeros(1,300);
j=0;
% parameter range
for(r=2.8:0.001:4)
j=j+1;
% random nitiation of iteration
xn1=rand(1);
for(i=1:600)
% calculate logistic map
xn=xn1;
xn1=r*xn*(1-xn);
% wait for transients
if(i>300)
% store the orbit points
orbit(i-300)=xn1;
end
end
plot(r,orbit);
if(j==1)
axis([2.8 4 0 1]);
hold;
end
end
0 commentaires
Réponse acceptée
Star Strider
le 8 Déc 2019
Try this slight edit of your code:
orbit=zeros(1,300);
j=0;
% parameter range
rv=2.8:0.001:4;
for k = 1:numel(rv)
r = rv(k);
j=j+1;
% random nitiation of iteration
xn1=rand(1);
for i=1:600
% calculate logistic map
xn=xn1;
xn1=r*xn*(1-xn);
% wait for transients
if(i>300)
% store the orbit points
orbit(i-300,k)=xn1;
end
end
% plot(r,orbit,'.');
if(j==1)
axis([2.8 4 0 1]);
hold;
end
end
figure
plot(rv, orbit, '.');
axis([2.8 4 0 1]);
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!