我想(N-1)(1-X_(N-1))通過使用MATLAB繪製x_n = RX_的20次迭代:繪製迭代
r = 3;
x = 0.8;
MaxIter=20;
for r = R
x = rand(1,N);
% iterate the logistic map
for iter=1:MaxIter
x = r*x.*(1-x);
end
X = [X; x]; % store the positions
end
iter = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]
figure; %// opens figure
hold on %// plots multiple things in one figure
plot(iter,X)
我目前返回錯誤。
Error using plot
Vectors must be the same length.
Error in Untitled5 (line 16)
plot(iter,X)
我的目的,觀察哪些值,這將如果你仔細觀察你會發現,你有 for循環和你plot
命令是他們兩人之外
你可以更具體一點,並提供實際的錯誤信息?什麼是「R」? – Suever
@Suever我編輯了這個問題 – Nique