clear;clc;close all
%% 参数设定
L=25; % 二进制码元数
SamPerSyb=20; % 每个符号点样点数
Ts=2; % 码元宽度
Rs=1/Ts; % 码元速率
fs=SamPerSyb*Rs; % 采样率
eyeNum=5; % 眼图眼睛数量
%% 信源
a=rand(L,1);
an=zeros(L,1);
for n=1:L
if a(n)>=0.5
an(n)=1;
else
an(n)=-1;
end
end
%% 矩形脉冲
at=reshape(repmat(an,1,SamPerSyb)’,[],1);
%% 眼图0
Nt=length(at); % 信号采样点数
figure
for k=1:L-eyeNum
aa=at(k*SamPerSyb+1:(k+eyeNum)*SamPerSyb);
plot(aa,‘b’,‘linewidth’,2),hold on
end
axis([-inf inf -1.5 1.5]),title(‘原始眼图’)
Af=fftshift(fft(at)); % 信号频谱
f=(-Nt/2:Nt/2-1)fs/Nt; % 频率采样点
%% 眼图1
A1=Af;
A1(f<=-5/(2Ts)|f>=5/(2Ts))=0;% 信道响应