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

Search This Blog

HAHA Emoji in MATLAB


Code:
clc
clear all
close all
figure;
axis([-3 3 -3 3]);
axis square;
pause(10);
%body
t=0:0.01:2*pi;
x=cos(t);
y=sin(t);
fill(x,y,'y');
axis square;
axis([-3 3 -3 3]);
hold on;
pause(1);
%mouth
t=pi:0.01:2*pi;
x=0.5*cos(t);
y=-0.2+0.5*sin(t);
fill(x,y,'k');
pause(1);
a=[];
b=[];
gemp=0;
for i=1:length(x)
    if((y(i)<=-0.6337) && (x(i)>=-0.2531 && x(i)<=0.2531))
        b=[b y(i)+0.01*gemp];
        gemp=gemp+0.01;
        a=[a x(i)];
    end
end
fill(a,b,'r');
pause(1);
%left eye
x=[-0.6 -0.3 -0.6];
y=[0.4 0.3 0.2];
plot(x,y,'k','linewidth',3);
pause(1);
%right eye
x=[0.6 0.3 0.6];
y=[0.4 0.3 0.2];
plot(x,y,'k','linewidth',3);
pause(1);
text(-0.5,2,'HAHA','Color','blue','FontSize',30)

No comments

Popular Posts