⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eyediag.m

📁 通信原理中关于眼图的matlab仿真程序。
💻 M
字号:
% eyediag.m plot eye diagrams for pulse shape psN=1000; m=pam(N,2,1);                   % random signal of length NM=20; mup=zeros(1,N*M); mup(1:M:end)=m; % oversampling by factor of Mps=hamming(M);                          % hamming pulse of width Mx=filter(ps,1,mup);                     % convolve pulse shape with mupneye=5; c=floor(length(x)/(neye*M));    % number of eyes to plotxp=x(end-neye*M*c+1:end);               % dont plot transients at startplot(reshape(xp,neye*M,c))title('Eye diagram for rectangular pulse shape')figure(2)                   % used to plot figure eyediag3N=1000; m=pam(N,2,1);          % random +/-1 signal of length NM=20; mup=zeros(1,N*M); mup(1:M:end)=m; % oversampling by factor of ML=10; ps=SRRC(L,0,M,0);                 % sinc pulse shape L symbols wideps=ones(1,M);                           % square pulse width Mx=filter(ps,1,mup);    % convolve pulse shape with mup%x=x+0.15*randn(size(x));neye=5;c=floor(length(x)/(neye*M))xp=x(end-neye*M*c+1:end);                       % dont plot transients at startq=reshape(xp,neye*M,c);     % plot in clusters of size 5*Mt=(1:198)/50+1;subplot(3,1,1), plot(q)title('Eye diagram for rectangular pulse shape')N=1000; m=pam(N,2,1);          % random +/-1 signal of length NM=20; mup=zeros(1,N*M); mup(1:M:end)=m; % oversampling by factor of ML=10; ps=SRRC(L,0,M,0);                 % sinc pulse shape L symbols wideps=hamming(M);                           % square pulse width Mx=filter(ps,1,mup);    % convolve pulse shape with mup%x=x+0.15*randn(size(x));neye=5;c=floor(length(x)/(neye*M))xp=x(end-neye*M*c+1:end);                       % dont plot transients at startq=reshape(xp,neye*M,c);     % plot in clusters of size 5*Mt=(1:198)/50+1;subplot(3,1,2), plot(q)title('Eye diagram for hamming pulse shape')N=1000; m=pam(N,2,1);          % random +/-1 signal of length NM=20; mup=zeros(1,N*M); mup(1:M:end)=m; % oversampling by factor of ML=10; ps=SRRC(L,0,M,50); ps=ps/max(ps); % sinc pulse shape L symbols widex=filter(ps,1,mup);    % convolve pulse shape with mup%x=x+0.15*randn(size(x));neye=5;c=floor(length(x)/(neye*M))xp=x(end-neye*M*(c-3)+1:end);       % dont plot transients at startq=reshape(xp,neye*M,c-3);     % plot in clusters of size 5*Mt=(1:198)/50+1;subplot(3,1,3), plot(q)axis([0,100,-3,3])title('Eye diagram for sinc pulse shape')figure(3),clfN=1000; m=pam(N,4,5);          % random +/-1 signal of length NM=20; mup=zeros(1,N*M); mup(1:M:end)=m; % oversampling by factor of Mps=hamming(M);                           % square pulse width Mx=filter(ps,1,mup);    % convolve pulse shape with mup%x=x+0.15*randn(size(x));neye=5;c=floor(length(x)/(neye*M))xp=x(end-neye*M*c+1:end);                       % dont plot transients at startq=reshape(xp,neye*M,c);     % plot in clusters of size 5*Mt=(1:198)/50+1;t=(1:neye*M)/M;subplot(4,1,1), plot(t,q)hold ontitle('Eye diagram for the T-wide hamming pulse shape')N=1000; m=pam(N,4,5);                   % random signal of length NM=20; mup=zeros(1,N*M); mup(1:M:end)=m; % oversampling by factor of Mps=hamming(2*M);                          % hamming pulse of width Mx=filter(ps,1,mup);                     % convolve pulse shape with mupneye=5; c=floor(length(x)/(neye*M));    % number of eyes to plotxp=x(end-neye*M*(c-3)+1:end);               % dont plot transients at startt=(1:neye*M)/M;subplot(4,1,2),plot(t,reshape(xp,neye*M,c-3))title('Eye diagram for the 2T-wide hamming pulse shape')N=1000; m=pam(N,4,5);                   % random signal of length NM=20; mup=zeros(1,N*M); mup(1:M:end)=m; % oversampling by factor of Mps=hamming(3*M);                          % hamming pulse of width Mx=filter(ps,1,mup);                     % convolve pulse shape with mupneye=5; c=floor(length(x)/(neye*M));    % number of eyes to plotxp=x(end-neye*M*(c-3)+1:end);               % dont plot transients at startsubplot(4,1,3),plot(t,3/4*reshape(xp,neye*M,c-3))title('Eye diagram for the 3T-wide hamming pulse shape')N=1000; m=pam(N,4,5);                   % random signal of length NM=20; mup=zeros(1,N*M); mup(1:M:end)=m; % oversampling by factor of Mps=hamming(5*M);                          % hamming pulse of width Mx=filter(ps,1,mup);                     % convolve pulse shape with mupneye=5; c=floor(length(x)/(neye*M));    % number of eyes to plotxp=x(end-neye*M*(c-3)+1:end);               % dont plot transients at startsubplot(4,1,4),plot(t,3/5*reshape(xp,neye*M,c-3))title('Eye diagram for the 5T-wide hamming pulse shape')xlabel('symbols')hold offL=10; ps=SRRC(L,0,M,0);                 % sinc pulse shape L symbols wideps=ones(1,M);                           % square pulse width M

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -