100% found this document useful (1 vote)
1K views1 page

Carita Feliz Matlab

The document contains MATLAB code to plot a smiling face figure. It first plots a circle to represent the face contour, then adds eyes by plotting offset circles with decreasing radii. A half-circle is plotted for the mouth. Additional code is included to add hair by plotting parabolic curves of varying heights above the head. Text is placed to represent features like eyes and a nose. The code is rerun with modifications to use text and a quadratic function instead of separate plots to represent the features.

Uploaded by

Soraya Bersoza
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
1K views1 page

Carita Feliz Matlab

The document contains MATLAB code to plot a smiling face figure. It first plots a circle to represent the face contour, then adds eyes by plotting offset circles with decreasing radii. A half-circle is plotted for the mouth. Additional code is included to add hair by plotting parabolic curves of varying heights above the head. Text is placed to represent features like eyes and a nose. The code is rerun with modifications to use text and a quadratic function instead of separate plots to represent the features.

Uploaded by

Soraya Bersoza
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

clc,clear,clf,hold off

dt=pi/20;
t=0:dt:2*pi;
x=cos(t);
y=sin(t);
axis([-1 1 -1 1]), hold on
plot(x,y) %contorno cara
hold on
axis ('square')
for k=1:-.05:.1
plot(k*.3*x-.3,k*0.20*y+.1) %ojo izquierdo
plot(k*.25*x+.3,k*0.15*y+.1) %ojo derecho
end
s1=3*pi/2-1.1;
s2=3*pi/2+1.1;
s=s1:dt:s2;
xs=.5*cos(s);ys=.5*sin(s);
plot(xs,ys) %boca
x1=-.5:.1:.5;
y1=-0.2;
plot(x1,y1)
hold off
clear,clf,hold off
dt=pi/20;t=0:dt:2*pi;
x=cos(t);y=sin(t);
axis([-1 1 -1 1]), hold on
plot(x,y,'k') %contorno cara
hold on
axis ('square')
text(.2,.2,'O','FontSize',[80],'Color','b'),text(.3,.2,'O','FontSize',[20],'Colo
r','g') %ojo derecho
text(-.5,.2,'O','FontSize',[80],'Color','b'),text(-.4,.2,'O','FontSize',[20],'Co
lor','g') %ojo izquierdo
text(-.1,-.1,'U','FontSize',[30],'Color','k') %nariz
x1=-.5:.01:.5;
y1=(x1.^2)-.5;
plot(x1,y1,'+k') %sonrisa
for i=.8:.001:1.1 %cabello
x2=-.95:.01:.95;
y2=-.5*x2.^2+i;
plot(x2,y2,'y')
end

You might also like