(eyediagram) Why I cannot get the eyediagram?

4 次查看(过去 30 天)
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 个评论
Cris LaPierre
Cris LaPierre 2021-3-17
Consider pasting your code in rather than taking a screenshot. It's much easier to work with that way.
Kwan Ho NG
Kwan Ho NG 2021-3-17
编辑:Cris LaPierre 2021-3-17
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)

请先登录,再进行评论。

回答(1 个)

Cris LaPierre
Cris LaPierre 2021-3-17
编辑:Cris LaPierre 2021-3-17
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.
load vars.mat
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)

类别

Help CenterFile Exchange 中查找有关 Sources and Sinks 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by