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

Search This Blog

Drawing Elephant using MATLAB


Code:

figure;
axis([-5 5 -5 5]);
axis square;
pause(10);
hold on;
plot([-4 -5],[0 -1],'k','linewidth',2);
plot([-4 -4.8],[0 -1],'k','linewidth',2);
plot([-4 -4.6],[0 -1],'k','linewidth',2);
pause(2);
patch([-3.5 -2.8 -2.8 -3.5 -3.5],[-3 -3 -0.5 -0.5 -3],[0.4 0.4 0.4]);
pause(1);
patch([3.5 2.8 2.8 3.5 3.5],[-3 -3 -0.5 -0.5 -3],[0.4 0.4 0.4]);
pause(1);
patch([-2 -1.3 -1.3 -2 -2],[-3 -3 -0.5 -0.5 -3],[0.4 0.4 0.4]);
pause(1);
patch([2 1.3 1.3 2 2],[-3 -3 -0.5 -0.5 -3],[0.4 0.4 0.4]);
pause(1);
t=0:0.01:2*pi;
x=4*cos(t);
y=2*sin(t);
fill(x,y,[0.4 0.4 0.4]);
pause(1);
t=0:0.01:2*pi;
x=2+0.3*cos(t);
y=2+0.7*sin(t);
fill(x,y,[0.2 0.2 0.2]);
pause(0.5);
t=0:0.01:2*pi;
x=4+0.3*cos(t);
y=2+0.7*sin(t);
fill(x,y,[0.2 0.2 0.2]);
pause(0.5);
t=0:0.01:2*pi;
x=3+cos(t);
y=2+sin(t);
fill(x,y,[0.4 0.4 0.4]);
pause(1);
t=0:0.01:2*pi;
x=2.6+0.2*cos(t);
y=2.2+0.2*sin(t);
fill(x,y,'w');
pause(0.5);
axis square;
t=0:0.01:2*pi;
x=3.4+0.2*cos(t);
y=2.2+0.2*sin(t);
fill(x,y,'w');
axis square;
pause(0.5);
t=0:0.01:2*pi;
x=2.65+0.1*cos(t);
y=2.1+0.1*sin(t);
fill(x,y,'k');
axis square;
pause(1);
t=0:0.01:2*pi;
x=3.45+0.1*cos(t);
y=2.1+0.1*sin(t);
fill(x,y,'k');
axis square;
pause(1);
patch([2.8 3.2 3.2 2.8],[-2 -2 1.7 1.7],[0.2 0.2 0.2]);

Join us:https://www.facebook.com/groups/MATLABCODES/ 
Join Us: : https://t.me/matlabirawen

No comments

Popular Posts

Followers