Flower using Rotational Matrix in MATLAB Program
MATLAB Program:
Code:
figure;
pause(5);
fill([-10
-10 10 10],[-10 10 10 -10],'k');
hold
on;
pause(1);
t=0:0.01:pi;
x=0.5*sin(t);
plot(t,x,'w','linewidth',2);
hold
on;
for i=1:10
q=[t;x];
e=pi/4*i;
z=[cos(e)
-sin(e);sin(e) cos(e)];
k=z*q;
r=k(1,:);
d=k(2,:);
plot(r,d,'w','linewidth',2);
pause(0.5);
axis
equal;
end
t=0:0.01:pi;
x=-0.5*sin(t);
plot(t,x,'w','linewidth',2);
hold
on;
for i=1:10
q=[t;x];
e=-pi/4*i;
z=[cos(e)
-sin(e);sin(e) cos(e)];
k=z*q;
r=k(1,:);
d=k(2,:);
plot(r,d,'w','linewidth',2);
pause(0.5);
hold
on;
axis
equal;
end
hold
on;
No comments