Impact-Site-Verification: dbe48ff9-4514-40fe-8cc0-70131430799e

Search This Blog

Spinning Octagon in MATLAB


Code:

fill([-15 -15 10 10],[-15 10 10 -15],'k');
hold on;
axis([-15 10 -15 10]);
pause(10);
t=0:pi/4:2*pi;
x=5*cos(t);
y=5*sin(t);
a=x(2);
b=y(2);
axis equal;
hold on;
for i=1:25
hold on;
q=[x+a;y+b];
q=q;
e=pi/10*i;
z=[cos(e) -sin(e);sin(e) cos(e)];
k=z*q;
r=k(1,:)-a;
d=k(2,:)-b;
plot(r,d,'w','linewidth',2);
hold on;
axis square;
pause(0.4);
end

Code:

fill([-15 -15 10 10],[-15 10 10 -15],'k');
hold on;
axis([-15 10 -15 10]);
pause(10);
t=0:pi/4:2*pi;
x=5*cos(t);
y=5*sin(t);
a=x(2);
b=y(2);
axis equal;
hold on;
for i=1:25
hold on;
q=[x+a;y+b];
q=q;
e=pi/10*i;
z=[cos(e) -sin(e);sin(e) cos(e)];
k=z*q;
r=k(1,:)-a;
d=k(2,:)-b;
plot(r,d,'w','linewidth',2);
hold on;
axis square;
pause(0.4);
end

Join us on Telegram : https://t.me/matlabirawen

No comments

Popular Posts

Followers