Boat in MATLAB

MATLAB Program:


Code:

fill([-10 -10 10 10],[0 10  10 0],'k');
axis([-10 10 0 10]);
hold on;
pause(1);
axis equal;
t=-10:0.01:10;
x=5-0.5*abs(sin(t));
area(t,x);
axis([-10 10 0 10]);
pause(1);
t=pi:0.01:2*pi;
x=5*cos(t);
y=5+2*sin(t);
fill(x,y,'w');
pause(1);
grid on;
plot([-5 5],[0+5 0+5]);
plot([0 0],[0+5 4+5],'linewidth',3);
pause(1);
fill([0 0 -4 0],[1+5 4+5 1+5 1+5],'w');
grid on;


No comments