You are on page 1of 5

DESARROLLO DEL 4TO LABORATORIO

1.

function [pf]=f1(p)
igv=0.18;
pf=p*(1+igv);
end

2.

function [y]=f2(n)
x=-n:0.1:n;
y=x.^2;
plot(x,y);
grid;
end

3.

function [y]=f1(p)
x=-p:0.1:p;
y=x.^p;
plot(x,y);
grid;
end

II Empezando todo con: Muestreo y Cuantificacin con Funciones


function [M,N,X]=pedir_imagen
[fichero,p1]=uigetfile(('*.bmp,jpg,tif'),'imagen a procesar');
s1=strcat(p1,fichero);
[x,map]=imread(s1)
[M,N,T]=size(x);
X=im2double(x);
imshow(X)
end

1. untecs256=imread('F:\Penguins.jpg')
untecs256=im2double(untecs256)
2. imshow(untecs256)

3. untecs128=untecs256(1:2:end,1:2:end,1:1:end)
imshow(untecs128)
4. untecs128=untecs256(1:3:end,1:3:end,1:1:end)
imshow(untecs128)
5. untecs128=untecs256(1:6:end,1:6:end,1:1:end)
imshow(untecs128)
untecs128=untecs256(1:6:end,1:3:end,1:1:end)
imshow(untecs128)

Funcin Replica

TAREA
1. A) Permetro de una circunferencia
function p=permetro(r)
p=2*3.1416*r;
end

B) rea de una circunferencia


function S=area(r)
S=3.1416*r.^2;
end

C) rea y permetro de una circunferencia


function [S,P]=ambos(r)
S=3.1416*r.^2;
P=2*3.1416*r;
end

2. Calculo de races de la ecuacin de segundo grado


function [x1,x2]=raices(a,b,c)
x1=(-b+sqrt(b.^2-4*a*c))/2*a;
x2=(-b-sqrt(b.^2-4*a*c))/2*a;
end

3. Convertir un nmero binario a hexadecimal


A)
function [h]=pase(a)
d=bin2dec(a);
h=dec2hex(d);
end

B)
function [h]=pase(a,x)
switch x
case 1,
h=dec2bin(a);
case 2,
d=bin2dec(a);
h=dec2hex(d);

case 3,
h=dec2hex(a);
case 4,
h=hex2dec(a);
case 5,
h=bin2dec(a);
end

4. rea y Permetro de un cilindro


function [S,V]=ambos(r,h)
S=2*pi.^2 + 2*pi*r*h;
V=pi*r.^2*h;
end

5. Resistencia en serie y paralelo


function [rs,rp]=resistencia(r1,r2,r3)
rs=r1+r2+r3;
rp=1/((1/r1)+(1/r2)+(1/r3));
end

6.

You might also like