有懂迭代函式系統的么?我這個代碼是有什么問題嗎?運行圖形不對
以下為我的MATLAB代碼:
n=10000;
% IFS
M1=[0.195 -0.488 0.344 0.433 0.4431 0.2452 0.25];
M2=[0.462 0.414 -0.252 0.361 0.2511 0.5692 0.25];
M3=[-0.058 -0.07 0.453 -0.111 0.5976 0.0969 0.25];
M4=[-0.035 0.07 -0.469 -0.022 0.4884 0.5069 0.2];
M5=[-0.637 0.0 0.0 0.501 0.8562 0.2513 0.05];
x=0;y=0;
% r為[0,1]區間內產生的n維隨機陣列
r = rand(1,n);
B = zeros(2,n);
for i = 1 : n
if r(i) < M1(7)
a=M1(1);b=M1(2);e=M1(3);c=M1(4);d=M1(5);f=M1(6);
else if r(i) < M1(7)+M2(7)
a=M2(1);b=M2(2);e=M2(3);c=M2(4);d=M2(5);f=M2(6);
else if r(i) < M1(7)+M2(7)+M3(7)
a=M3(1);b=M3(2);e=M3(3);c=M3(4);d=M3(5);f=M3(6);
else if r(i) < M1(7)+M2(7)+M3(7)+M4(7)
a=M4(1);b=M4(2);e=M4(3);c=M4(4);d=M4(5);f=M4(6);
else
a=M5(1);b=M5(2);e=M5(3);c=M5(4);d=M5(5);f=M5(6);
end
end
end
end
% 仿射變換計算
x = a*x + b*y + e;
y = c*x + d*y + f;
B(1,i) = x; %代表k點的橫坐標
B(2,i) = y; %代表k點的中坐標
end
plot(B(1,:),B(2,:),'.','markersize',1)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/51291.html
標籤:其他開發語言
上一篇:大佬求助
下一篇:def sendKey、def elementclick呼叫 def getElement對定位元素型別判斷失敗,怎么改
