Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Matlab-Programs-for-Nonlinear-Dynamics/logistic.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
40 lines (29 sloc)
724 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% logistic.m | |
% Logistic map | |
clear | |
xold = 0.231; | |
maxg = 900; % 4000 for good coverage (pause off) | |
ming = 2.9; | |
figure(1); | |
clf | |
axis([2.7 4 0 1]); | |
hold on | |
for gainloop = 1:maxg | |
g=(4.00-ming)*gainloop/maxg + ming; | |
for sloop = 1:100 %settle-down loop | |
xnew = g*xold*(1-xold); | |
xold = xnew; | |
end % end settle-down loop | |
rep = 64; | |
ind = 0; | |
for rloop = 1:rep | |
xnew = g*xold*(1-xold); | |
xold = xnew; | |
ind = ind + 1; | |
x(ind) = g + (4.00-ming)*(rloop-1)/(maxg*rep); | |
y(ind) = xnew; | |
end % end rloop | |
plot(x,y,'o','MarkerSize',2); | |
pause(0.01) % Take pause off to watch real-time, but put maxg to 300 | |
end % end gainloop | |
hold off | |