Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

2.

1
a) >> x = 0:0.1:(4*pi);
>> y=sin(x)./(1+cos (x));
>> plot(x,y)
>> xlabel('x');ylabel('y')

2.1
b) >> y=1./(1+(x-2).^2);
>> x = 0:0.1:4;
>> y=1./(1+(x-2).^2);
>> plot(x,y)
>> xlabel('x');ylabel('y')

2.1
c) >> x = 0:0.1:10;
>> y=exp(-x).*x.^2;
>> plot(x,y)
>> xlabel('x');ylabel('y')

2.3
a)
>> x=0:0.1:6;
>> y1=((x-1).*(x-2).*(x-4).*(x-5))./((3-1).*(3-2).*(3-4).*(3-5));
>> y2=((x-2).*(x-3).*(x-4).*(x-5))./((1-2).*(1-3).*(1-4).*(1-5));
plot(x,y1,x,y2)

b)
>> x=0:0.1:6;
>> y1=((x-1).*(x-2).*(x-4).*(x-5))./((3-1).*(3-2).*(3-4).*(3-5));
>> plot(x,y1);
>> hold on
>> y2=((x-2).*(x-3).*(x-4).*(x-5))./((1-2).*(1-3).*(1-4).*(1-5));
>> plot(x,y2,'--')
>> xlabel('x');ylabel('y1(-),y2(--)')

2.6
>> t=0:0.1:(4*pi);
>> x=sin(-t)+t;
>> y=1-cos(-t);
>> plot(x,y)

2.8
>> x=(0:.01:4*pi)'; y=sin(x)./(1+cos(x));plot(x,y),grid,title('Funcion y(x)')
>> x=-3:0.01:3;
y=-3:0.01:3;
[x,y]=meshgrid(x,y);
z=0.2*cos(x)+y.*exp(-x.^2.-y.^2);
mesh(x,y,z)
xlabel ('x')
ylabel ('y')
zlabel ('z')
grid on
title ('Grafica de funcion con mesh'

2.12 Dibuje su propia carita feliz con nariz y cabello.


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 de la cara
hold on
for k=0.8:-0.5:0.5

plot (k*0.1*x-0.3,k*0.15*y+0.1)
plot (k*0.1*x+0.3,k*0.15*y+0.1)
end
s1=3*pi/2-1.1;
s2=3*pi/2+1.1;
s=s1:dt:s2
xs=0.5*cos(s); ys=0.5*sin(s);
plot(xs,ys) %boca
hold off

%ojo izquierdo
%ojo derecho

You might also like