Mnchester différentielle
Bonjour,
j'ai programmé un code matlab qui permet de coder la séquence de bit en codage Manchester différentielle mais l'affichage n'est pas correct, voici mon essai et merci d'avance !
close all;
clear all;
a=[0 1 0 1 1 0 0 1 1 0 1]
t=0:0.5:10 ;
if a(1)==1
{
x(2*1-1)= 1;
x(2)=-1;
else
x(2)= -1;
x(2*1-1)= 1;
}
l=length(t);
for i=2:l/2
if a(i)==1 && a(i-1)==0
x(2*i-1)= 1;
x(2*i)=-1;
elseif a(i)==1 && a(i-1)==1
x(2*i)= -1;
x(2*i-1)= 1;
elseif a(i)==0 && a(i-1)==0
x(2*i)= -1;
x(2*i-1)= 1;
else a(i)==0 && a(i-1)==1
x(2*i-1)= 1;
x(2*i)=-1;
end;
end;
figure;
stairs(x);
axis([1 length(t)-1 -4 4]));
grid on;
title('Manchester');
j'ai programmé un code matlab qui permet de coder la séquence de bit en codage Manchester différentielle mais l'affichage n'est pas correct, voici mon essai et merci d'avance !
close all;
clear all;
a=[0 1 0 1 1 0 0 1 1 0 1]
t=0:0.5:10 ;
if a(1)==1
{
x(2*1-1)= 1;
x(2)=-1;
else
x(2)= -1;
x(2*1-1)= 1;
}
l=length(t);
for i=2:l/2
if a(i)==1 && a(i-1)==0
x(2*i-1)= 1;
x(2*i)=-1;
elseif a(i)==1 && a(i-1)==1
x(2*i)= -1;
x(2*i-1)= 1;
elseif a(i)==0 && a(i-1)==0
x(2*i)= -1;
x(2*i-1)= 1;
else a(i)==0 && a(i-1)==1
x(2*i-1)= 1;
x(2*i)=-1;
end;
end;
figure;
stairs(x);
axis([1 length(t)-1 -4 4]));
grid on;
title('Manchester');