Sunteți pe pagina 1din 7

Ejercicio 1

>> sym x
>> F=sym(abs(sin(x+1)));
>> ezplot(F,[2,4])
>> grid

Ejercicio 2
>> sym x
>> F=sym(sin(2*x));
>> ezplot(F,[-pi,pi])
>> hold on
>> G=diff(F);
>> H=ezplot(G,[-pi,pi]);
>> set(H,Color,r)

Ejercicio 3
>> syms x y
>> radio=1;
>> F=sym(x^2+y^2=1);
>> G=ezplot(F,[-3,3]); %El intervalo es para comodidad
>> set(G,Color,b)
>> hold on
>> y=o;
>> x=[-1,1];
>> y1=[y y];
>> plot(x,y1)
>> x=[0,1];
>> y=x.*tan(67);
>> [x,y]=solve(x^2+y^2=1,y=tan(67)*x,x,y) %Para hallar los puntos
donde corta la recta a la circunferencia y hallar sus intervalos para graficar

x=
1/(tan(67)^2 + 1)^(1/2)
-1/(tan(67)^2 + 1)^(1/2)

y=
tan(67)/(tan(67)^2 + 1)^(1/2)
-tan(67)/(tan(67)^2 + 1)^(1/2)
%Usamos valores positivos
>> x=[0, 1/(tan(67)^2 + 1)^(1/2)];
>> y=[0, tan(67)/(tan(67)^2 + 1)^(1/2)];
>> plot(x,y,[0, 1/(tan(67)^2 + 1)^(1/2)]) %Usamos el dominio antes calculado
con solve
>> grid
>> text(0,0,\leftarrow 67)
>> text(1/(tan(67)^2 + 1)^(1/2),tan(67)/(tan(67)^2 + 1)^(1/2),'\leftarrow
Punto A')

Ejercicio 4
>>subplot(2,2,1)
>> sym x
>> x=linspace(-pi,pi,100);
>> F=sym('a*x^2+b*x+c');
>> a=2;
>> b=3;
>> c=4;
>> F=sym('2*x^2+3*x+4');
>> ezplot(F)

>> subplot(2,2,2)
>> sym x
>> x=linspace(-pi,pi,100);
>> a=2;
>> b=2;
>> c=4;
>>
F=sym('2*x^2+2*x+4');
>> ezplot(F)

>> subplot(2,2,3)
>> sym x
>> x=linspace(-pi,pi,100);
>> a=2;
>> b=0;
>> c=4;
>>
F=sym('2*x^2+0*x+4');
>> ezplot(F)

>> subplot(2,2,4)
>> sym x
>> x=linspace(-pi,pi,100);
>> a=2;
>> b=-2;
>> c=4;
>> F=sym('2*x^2-2*x+4');
>> ezplot(F)

Ejercicio 5
>> teta=linspace(0,2*pi,100);
>> r=1+2*sin(6*teta);
>> polar(teta,r)

Ejercicio 6
>>b=1;
>>p=raylrnd(1,30000,1);
>>xx=0:0.1:4;
>>yy=hist(p,xx);
>>yy=yy/(30000*0.1);
>>bar(xx,yy)

>>figure
>>b=1;
>>p=raylrnd(1,30000,1);
>>xx=0:0.1:4;
>>yy=hist(p,xx);
>>yy=yy/(30000*0.1);
>>y=raylpdf(xx,1);
>>hist(y,20)

Ejercicio 8
>> [x,y]=meshgrid(-2:1:2,-0.5:0.5:3);
>> z=100*(y-x.^2).^2+(1-x).^2;
>> mesh(x,y,z)
>> figure
>> contour(x,y,z)

Ejercicio 9
>> [x,y]=meshgrid(1:0.5:5,1:0.5:5);
>> z=((x.^2-2*x).^2)*exp(-x.^2-y.^2-x*y);
>>mesh(z)
>>figure
>>surf(z)

Ejercicio 10
>>[x,y]=meshgrid(1:0.5:5,1:0.5:5);
>> z=((x.^2-2*x).^2)*exp(-x.^2-y.^2-x*y);
>>waterfall(z)
>> imagen_entrada=imread('problema 9 surf.jpg'); %usamos la grfica del
ejercicio 9 como base
>> imshow(imagen_entrada)
>> imagen_grices=rgb2gray(imagen_entrada);
>>%imagen en capas que representan los colores de la imagen
>> imR=double(imagen_entrada(:,:,1));
>> imG=double(imagen_entrada(:,:,2));
>> imB=double(imagen_entrada(:,:,3));
>> imagenR=imR-imG-imB;
>> figure
>> imshow(imagenR)
>> imagen_filtrada=medfilt2(imagenR); %Para eliminar pixeles sueltos
>> figure
>> imshow(imagen_filtrada)
>> mascara=1-imagen_filtrada; %Devuelve la inversa de imagen_filtrada
%Para eliminar los otros colores como verde y azul ya que tomamos rojo al
inicio
>> figure
>> imshow(mascara)
>>%Eliminar las 2 composiciones excepto la de la variable en cada caso rojo
verde y azul
>> imagenroja=double(imagen_grices)/255; %255 mayor valor de una imagen
RGB
>> imagenverde=double(imagen_grices).*mascara/255;
>> imagenazul=double(imagen_grices).*mascara/255;
>> imagen_final=cat(3,imagenroja,imagenverde,imagenazul); %Para
concatenar las matrices
>> figure
>> imshow(imagen_final)

S-ar putea să vă placă și