Truck in MATLAB
MATLAB Program.
%Code:
figure;
pause(5);
axis([-20
40 -6 6]);
fill([-20 -20 40 40],[-20 20 20 -20],'k');
pause(1);
hold
on;
plot([-20
40],[-10.5 -10.5],'w','linewidth',3);
axis
square;
pause(1);
hold
on;
plot([-15
15 15 -15 -15],[0 0 -8 -8 0],'w','linewidth',3);
pause(1);
t=0:0.01:2*pi;
x=-10+2.2*cos(t);
y=-8+2.2*sin(t);
fill(x,y,'w');
axis
square;
t=0:0.01:2*pi;
x=10+2.2*cos(t);
y=-8+2.2*sin(t);
fill(x,y,'w');
axis
square;
t=0:0.01:pi;
x=-10+2.5*cos(t);
y=-8+2.5*sin(t);
plot(x,y,'w','linewidth',2);
axis
square;
t=0:0.01:pi;
x=10+2.5*cos(t);
y=-8+2.5*sin(t);
plot(x,y,'w','linewidth',2);
axis
square;
grid
on;
pause(1);
fill([15 15 20 25 25],[-8 -1 -1 -4 -8],'w');
pause(1);
t=0:0.01:2*pi;
x=20+2.5*cos(t);
y=-8+2.5*sin(t);
plot(x,y,'k','linewidth',2);
axis
square;
t=0:0.01:2*pi;
x=20+2.4*cos(t);
y=-8+2.4*sin(t);
fill(x,y,'w');
axis
square;
grid
on
pause(1);
fill([16 16 20 23 23],[-4 -2 -2 -4 -4],'k');
plot([-20
40],[-10.5 -10.5],'w','linewidth',3);
No comments