用matlab 画 Lyapunov exponent logistic map

来源:百度知道 编辑:UC知道 时间:2024/06/21 18:24:31
function h=lyapunov(r,x0,Npre,n)
轨迹起点x0=0.4 h 是Lyapunov exponent

自己弄了一个,不知道是哪里不对了,出来的图不对

要分别搞2个程式

1。
function h = lyapunov(r, x0, Npre, n)

x = x0;
% Loop of pre-iteriates
for k = 1:Npre,
x = r*x*(1-x);
end,

h = 0;
for k = 1:n,
% Add logarithm of the map derivative at the orbit point x
h = h + log(abs(2.*x));
% Compute the next point in the orbit
x = r*x*(1-x);
end,
h = h./n;

2
function lyapunov2(x0, Npre, n, rmin, rmax, Nr)

dr = (rmax-rmin)/(Nr-1);
for r = rmin:dr:rmax,
h = lyapunov(r,x0,Npre,n);
plot(r,h,'.'); hold on;
end,
title('Lyapunov exponent of the logistic map');
xlabel('r'); ylabel('Lyapunov exponent');
hold off; grid on;

然后command
>>lyapunov2(0.4, 100, 1000, 3.7, 4, 1000);

是不是哪里出

程序运行没有问题。
看看你的编写思路或者表达方式对不对。

function h=lyapunov(r,x0,Npre,n)
轨迹起点x0=0.4 h 是Lyapunov exponent

要分别搞2个程式

1。
function h = lyapunov(r, x0, Npre, n)

x = x0;
% Loop of pre-iteriates
for k = 1:Npre,
x = r*x*(1-x);
end,

h = 0;
for k = 1:n,
% Add logarithm of the map derivative at the orbit point x
h = h + log(abs(2.*x));
% Compute the next point in the orbit
x = r*x*(1-x);
end,
h = h./n;

2
function lyapunov2(x0, Npre, n, rmin, rmax, Nr)

dr = (rmax-rmin)/(Nr-1);
for r = rmin:dr:rmax,
h = lyapunov(r,x0,Npre,n);
plot(r,h,'.'); hold on;
end,
title('Lyapunov exponent of the logistic map');
xlabel('r'); ylabel('Lyapunov exponent');
hold off; grid on;

然后command
>>lyapunov2(0.4, 100, 1000, 3.7, 4, 1000sff67555