Created
September 12, 2014 03:58
-
-
Save ericjang/138ded937613fae660b4 to your computer and use it in GitHub Desktop.
Feigenbaum Diagram
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
% feigenbaum diagram | |
r = 1:.01:4; % r values | |
nr = length(r); % number of r values | |
nI = 600; % number of iterations to perform for each r | |
converge = 300; | |
p = nan(converge,nr); | |
x = zeros(1,nI); | |
for rx=1:nr | |
x(1)=.5; | |
for i=2:nI | |
x(i)=r(rx)*x(i-1)*(1-x(i-1)); % logistic map | |
end | |
% pick the last 100 values. if converge to single value, they all get | |
% plotted on same point. if 2 periods, we will see 2 values | |
p(:,rx) = x((end-converge+1):end); | |
end | |
plot(r,p,'k.'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment