作者ANUBISANKH (Pourquoi?)
看板NTUNL
标题[资讯] Logistic map 的 matlab 程式
时间Thu Jun 4 10:44:36 2009
几年前写的,会跑出两个图。第一个是把理论计算和实验方法取得的 Lyapunov 指数随
参数变化 plot 出来;第二个是把 fixed points 找出来,可看出随参数变化有 period
doubling。
clc;
close all;
clear all;
I=100; % Iteration
n=5; % separation between pairs
A=1; % f(x)=ux(1-x),
B=4; %"u" from A to B
ai=0.001; % resolution of parameter "u"
f=round((B-A)/ai);
for u=1:f
U=u*ai;
x(u,1)=0.501;
% Iteration and calculating theoretical Lyapunov exponent
sum=0;
for i=1:I
x(u,i+1)=(U+A)*x(u,i)*(1-x(u,i)); % logistic map
sum=sum+log(abs((U+A)*(1-2*(1-x(u,i)))));
end
Lt(u)=sum/I;
% find closest points then calculate largest Lyapunov exponent
counter=0;
Lsum=0;
for i=2:I+1
if abs(x(u,1)-x(u,i))<0.05
if 0<abs(x(u,1)-x(u,i))
if i+n<I
if 0<abs(x(u,1+n)-x(u,i+n))
counter=counter+1;
L(counter)=(1/n)*log(abs(x(u,1+n)-x(u,i+n))/abs(x(u,1)-x(u,i)));
Lsum=Lsum+L(counter);
end
end
end
end
end
Lave(u)=Lsum/counter;
end
% plot theoretical and experimental data of L.E. together
figure(1)
plot([A+ai:ai:B],Lave,[A+ai:ai:B],Lt)
figure(2)
u=1:f;
i=round(0.7*I):I;
fixed=plot((u*ai+A),x(u,i),'.')
set(fixed,'MarkerSize',4.5);
--
"Bureaucrats!" Mallory scoffed cheerily. "They might known this would happen,
if they'd properly studied Catastrophist theory. It is a concatenation of
synergistic interactions; the whole system is on the PERIOD-DOUBLING ROUTE TO
CHAOS!"
----《Difference Engine》
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.228.192.166
1F:推 Keelungman:这个好!!! 06/04 23:03