# (eyediagram) Why I cannot get the eyediagram?

2 visualizaciones (últimos 30 días)
Kwan Ho NG el 17 de Mzo. de 2021
Comentada: Kwan Ho NG el 17 de Mzo. de 2021
clear;
M=2000
N=200;
temp= rand(1,M);
for i=1:M
if temp(i)>0.5
D(i)=1;
else
D(i)=-1;
end;
end;
Ns=10; % Ns=5 or Ns=10
for i=1:M
for j=1:Ns
D_ext((i-1)*Ns+j)=D(i);
end;
end;
h = firrcos(200,0.5,0.35,10, 'rolloff');%modify the parameter in different steps
out=conv(h,D_ext);
out_leng=length(out);
out_stable=(N+1:out_leng-N);
eyediagram(out_stable,20)
This is what I got.
This is the expected result.
##### 2 comentariosMostrar NingunoOcultar Ninguno
Cris LaPierre el 17 de Mzo. de 2021
Consider pasting your code in rather than taking a screenshot. It's much easier to work with that way.
Kwan Ho NG el 17 de Mzo. de 2021
Editada: Cris LaPierre el 17 de Mzo. de 2021
clear;
M=2000
N=200;
temp= rand(1,M);
for i=1:M
if temp(i)>0.5
D(i)=1;
else
D(i)=-1;
end;
end;
Ns=10; % Ns=5 or Ns=10
for i=1:M
for j=1:Ns
D_ext((i-1)*Ns+j)=D(i);
end;
end;
h = firrcos(200,0.5,0.35,10, 'rolloff');%modify the parameter in different steps
out=conv(h,D_ext);
out_leng=length(out);
out_stable=(N+1:out_leng-N);
eyediagram(out_stable,20)

Iniciar sesión para comentar.

### Respuestas (1)

Cris LaPierre el 17 de Mzo. de 2021
Editada: Cris LaPierre el 17 de Mzo. de 2021
The issue appears to be with how you create out_stable. The result of this is a straight line. If you create an eyediagram using out instead, you see you are mostly there. You likley meant to trim the tails of out to clean up the eye diagram.
h = firrcos(200,0.5,0.35,10, 'rolloff');%modify the parameter in different steps
out=conv(h,D_ext);
figure
plot(out)
figure
eyediagram(out,20)
out_leng=length(out);
out_stable=(N+1:out_leng-N);
figure
plot(out_stable)
eyediagram(out_stable,20)
That is likely due to the fact that out_stable is the index values of what you meant to keep from out. You forgot to tell the code to index these values from out. Try this instead.
figure
out_stable=out(N+1:out_leng-N);
% ^^^ Need to use your values as indices to out
eyediagram(out_stable,20)
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Kwan Ho NG el 17 de Mzo. de 2021
Thank you. It works.

Iniciar sesión para comentar.

### Categorías

Más información sobre Sources and Sinks en Help Center y File Exchange.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by