0
function f = flower(f)
t = (0:2*pi/100:2*pi);
x =((1+cos(5*t)).*(cos(t)));
y = (((x)).*(sin(t)));
A = [x,y];
G = [cos(45),-sin(45); sin(45),cos(45)];
if (f == 1)
plot(x,y,'-g')
elseif (f == 2)
b = zeros(1,101);
z = zeros(1,101);
for i = 1:101
b(1,i) = 2;
z(1,i) = -3;
end
x = x+b;
y = y+z;
plot(x,y,'-g')
elseif (f == 3)
A = A'*G;
plot(A(1,:),A(2,:),'-')
else
disp('input a number from 1-4')
end
(使用Matlab)我無法乘以一個矩陣來順時針旋轉它的圖像45度。代碼塊從elseif開始(f == 3)我得到一個內部矩陣維度必須同意錯誤。如何用矩陣G乘以矩陣A [x,y]?Matlab矩陣旋轉,尺寸
當然,我看到我犯的錯誤。謝謝。 –