(eyediagram) Why I cannot get the eyediagram?

조회 수: 4 (최근 30일)
Kwan Ho NG
Kwan Ho NG 2021년 3월 17일
댓글: Kwan Ho NG 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)
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