Professional Documents
Culture Documents
TRABAJO #1
Tema: Cdigo de Manchester y Codificacin
Diferencial
Realizado por:
Jorge Suasnavas
Curso: 7mo C
Fecha: 27-4-2012
CDIGO MANCHESTER
CDIGO EN MATLAB:
function MANCHESTER(h)
%Example:
%h=[1 0 0 1 1 0 1 0 1 0];
%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('CDIGO MANCHESTER');
set(d,'LineWidth',2.5);
hold on;
axis([0 length(h)-1 -1.5 1.5]);
%disp('UNO');
else
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('CODIGO MANCHESTER');
set(d,'LineWidth',2.5);
hold on;
axis([0 length(h)-1 -1.5 1.5]);
%disp('CERO');
end
n=n+1;
%pause;
end
Grfica Obtenida:
CODIGO MANCHESTER
1.5
0.5
-0.5
-1
-1.5
0 1 2 3 4 5 6 7 8
CODIFICACIN DIFERENCIAL
CDIGO EN MATLAB:
function DIFERENCIAL(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)+1*(t==n);;
end
d=plot(t,y);grid on;
title('CODIFICACION DIFERENCIAL');
set(d,'LineWidth',2.5);
hold on;
axis([0 length(h)-1 -1.5 1.5]);
disp('CERO');
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;
title('CODIFICACION DIFERENCIAL');
set(d,'LineWidth',2.5);
hold on;
axis([0 length(h)-1 -1.5 1.5]);
disp('UNO');
end
n=n+1;
%pause;
end
Datos ingresados en Matlab:
Grfica Obtenida:
CODIFICACION DIFERENCIAL
1.5
0.5
-0.5
-1
-1.5
0 1 2 3 4 5 6 7 8 9 10