From: William S on
I have to make a small program to graph the Bifurcation Diagram for the logistic Map and Brute Forcing the plot IS EXTREMELY SLOW.
Here is my code:
hold on%make sure the graph is holding on so does not create
%a blank graph every plot
r=1;%set r to starting value
trans = 2500;
postTrans = 100;
while r < 4
x = .653234;
for i=1:trans;%do transient iterations
x = r*x*(1-x); %converge the iteration
end
x(2:64) = zeros(1,63);%do
for i=1:postTrans%collect posttransient iterations
x(i+1) = r*x(i)*(1-x(i));
end
plot(r,x,'b');%plot vector of points in blue
r=r+0.003;%do a step size of .003;
end
How can I optimize it? Please help