Sie sind auf Seite 1von 6

UNIVERSIDAD NACIONAL DEL CALLAO

FACULTAD DE INGENIERIA ELECTRICA Y ELECTRONICA

LABORATORIO DE TELECOMUNICACIONES III


2 do LABORATORIO

CODIGOS DE LINEA
Objetivo:
Mostrar y comparar el los cdigos NRZ unipolar, RZ unipolar, NRZ polar, RZ polar,
AMI NRZ y Manchester.
Procedimiento:
1. Utilizando el workspace escribir en un M-file para representar los siguientes
cdigos:
a) NRZ unipolar
function y=UNRZ(h)
clf;
n=1;
l=length(h);
h(l+1)=1;
while n<=length(h)-1;
T=0.001;
t=n-1:T:n;
if h(n) == 0
if h(n+1)==0
y=(t>n);
else
y=(t==n);
end
d=plot(t,y);grid on;
title('UNIPOLAR NRZ');
hold on;
axis([0 length(h)-1 -1.5 1.5]);
else
if h(n+1)==0
y=(t<n)-0*(t==n);
else
y=(t<n)+1*(t==n);
end
d=plot(t,y);grid on;

UNIVERSIDAD NACIONAL DEL CALLAO


FACULTAD DE INGENIERIA ELECTRICA Y ELECTRONICA

title('UNIPOLAR NRZ');
hold on;
axis([0 length(h)-1 -1.5 1.5]);
end
n=n+1;
pause;
end
A continuacin en el workspace escribir h=[ 1 0 0 1 1 0 1 0 1 0 0 1] enter,
luego y=UNRZ(h), pulsar enter varias veces hasta que aparezca toda la
secuencia. (Use la misma secuencia h en todos los dems cdigos)
b) RZ unipolar
function y=URZ(h)
clf;
n=1;
l=length(h);
h(l+1)=1;
while n<=length(h)-1;
t=n-1:0.001:n;
if h(n) == 0
if h(n+1)==0
y=(t>n);
else
y=(t==n);
end
d=plot(t,y);grid on
title('UNIPOLAR RZ');
hold on;
axis([0 length(h)-1 -1.5 1.5]);
else
if h(n+1)==0
y=(t<n-0.5);
else
y=(t<n-0.5)+1*(t==n);
end
d=plot(t,y);grid on;
title('UNIPOLAR RZ');
hold on;
axis([0 length(h)-1 -1.5 1.5]);
end
n=n+1;
pause;
end

UNIVERSIDAD NACIONAL DEL CALLAO


FACULTAD DE INGENIERIA ELECTRICA Y ELECTRONICA

end
c) RNZ polar
function y=PNRZ(h)
clf;
n=1;
l=length(h);
h(l+1)=1;
while n<=length(h)-1;
t=n-1:0.001:n;
if h(n) == 0
if h(n+1)==0
y=-(t<n)-(t==n);
else
y=-(t<n)+(t==n);
end
d=plot(t,y);grid on;
title('POLAR NRZ');
hold on;
axis([0 length(h)-1 -1.5 1.5]);
else
if h(n+1)==0
y=(t<n)-1*(t==n);
else
y=(t<n)+1*(t==n);
end
d=plot(t,y);grid on;
title('POLAR NRZ');
hold on;
axis([0 length(h)-1 -1.5 1.5]);
end
n=n+1;
pause;
end
d) RZ polar
function y=BRZ(h)
clf;
n=1;
l=length(h);
h(l+1)=1;
while n<=length(h)-1;
t=n-1:0.001:n;
if h(n) == 0
if h(n+1)==0
y=-(t<n-0.5)-(t==n);

UNIVERSIDAD NACIONAL DEL CALLAO


FACULTAD DE INGENIERIA ELECTRICA Y ELECTRONICA

else
y=-(t<n-0.5)+(t==n);
end
d=plot(t,y);grid on;
title('BIPOLAR RZ');
hold on;
axis([0 length(h)-1 -1.5 1.5]);
else
if h(n+1)==0
y=(t<n-0.5)-1*(t==n);
else
y=(t<n-0.5)+1*(t==n);
end
d=plot(t,y);grid on;
title('BIPOLAR RZ');
hold on;
axis([0 length(h)-1 -1.5 1.5]);
end
n=n+1;
pause;
end
e) AMI NRZ
function y=AMINRZ(h)
clf;
n=1;
l=length(h);
h(l+1)=1;
ami=-1;
while n<=length(h)-1;
t=n-1:0.001:n;
if h(n) == 0
if h(n+1)==0
y=(t>n);
else
if ami==1
y=-(t==n);
else
y=(t==n);
end
end
d=plot(t,y);grid on;
title('AMI NRZ');
hold on;
axis([0 length(h)-1 -1.5 1.5]);
else

UNIVERSIDAD NACIONAL DEL CALLAO


FACULTAD DE INGENIERIA ELECTRICA Y ELECTRONICA

ami=ami*-1;
if h(n+1)==0
if ami==1
y=(t<n);
else
y=-(t<n);
end
else
if ami==1
y=(t<n)-(t==n);
else
y=-(t<n)+(t==n);
end
end
d=plot(t,y);grid on;
title(' AMI NRZ');
hold on;
axis([0 length(h)-1 -1.5 1.5]);
end
n=n+1;
pause;
end

f) MANCHESTER
function y=MANCHESTER(h)
clf;
n=1;
h=~h;
l=length(h);
h(l+1)=1;
while n<=length(h)-1;
t=n-1:0.001:n;
if h(n) == 0
if h(n+1)==0
y=-(t<n)+2*(t<n-0.5)+1*(t==n);
else
y=-(t<n)+2*(t<n-0.5)-1*(t==n);
end
d=plot(t,y);grid on;
title('MANCHESTER');
hold on;
axis([0 length(h)-1 -1.5 1.5]);
else
if h(n+1)==0
y=(t<n)-2*(t<n-0.5)+1*(t==n);

UNIVERSIDAD NACIONAL DEL CALLAO


FACULTAD DE INGENIERIA ELECTRICA Y ELECTRONICA

else
y=(t<n)-2*(t<n-0.5)-1*(t==n);
end
d=plot(t,y);grid on;
title('MANCHESTER');
hold on;
axis([0 length(h)-1 -1.5 1.5]);
end
n=n+1;
pause;
end

Presentacin del Informe.


1. Realizar el diagrama de flujo de los programas de cdigos realizados
2. Realizar un comparativo de los cdigos.
3. Realizar un M-file para el cdigo AMI BRZ
Para presentar el informe se debe basar en el formato tipo paper (indicado en la
primera clase.
Bibliografa.
1. Communications Blockset 3. Users Guide.
2. Getting Started with Communications Blockset 3
3. http://www.mathworks.com/.

Das könnte Ihnen auch gefallen