matlab函数eyediagram,Eyediagram Simulation in Matlab

本文档介绍了如何通过MATLAB程序模拟通信中的眼图,重点讨论了在不同带宽受限通道下(2.5Hz, 1Hz, 0.5Hz, 0.25Hz)的眼图形成过程,以及多脉冲调制(MPAM)中M-1眼的生成。通过示例展示了信号经过带通滤波、信道传播和加噪声后的信号变化,以及不同带宽下眼图的可视化结果。
摘要由CSDN通过智能技术生成

The programme is to simulating the eyediagram in communication.

As we all know, eyediagram happens in the limited-band

communication because the aquare pulses expand their wave. In

addition, one pulse generates M-1 "eyes" in MPAM.

Following is the programme.

%++++++++++++++++++++++++++++++++++++++++++++++++++++

%For eyediagram

%Writer:MQ

�ta:2011.11.15

%++++++++++++++++++++++++++++++++++++++++++++++++++++

clc;

clear all;

close all;

%++++++++++++++++++++++++++++++++++++++++++++++++++++

%Input parameter

%++++++++++++++++++++++++++++++++++++++++++++++++++++

N_eye=6;% the number of 'eye'

N_code=1e3;% the number of bit

N_sample=10;% sample numbers during one pulse

Ts=1;% duration of one pulse

dt=Ts/N_sample; % sampling interval

N0=0.01; % PSD of AWGN

%++++++++++++++++++++++++++++++++++++++++++++++++++++

%Generate the DNRZ signal

%++++++++++++++++++++++++++++++++++++++++++++++++++++

%Gnerate random bits

bits=rand(1,N_code)>0.5;

%Generate DNRZ

for k=1:length(bits)

if

bits(k)==0

bit(k)=-1;

elseif

bits(k)==1

bit(k)=1;

end

end

signal=zeros(1,N_code*N_sample);

signal(1:N_sample:N_code*N_sample)=bit;

pulse=ones(1,N_sample);

signal_tr=conv(signal,pulse);

signal_tr=signal_tr(1:N_code*N_sample);

%++++++++++++++++++++++++++++++++++++++++++++++++++++

�nd-limited channel

%++++++++++++++++++++++++++++++++++++++++++++++++++++

t=0:dt:(N_code*N_sample*dt-dt);

channel_filter1=5/Ts*sinc(5*(t-5)/Ts);% BandWidth=2.5Hz

channel_filter2=2/Ts*sinc(2*(t-5)/Ts);% BandWidth=1Hz

channel_filter3=1/Ts*sinc(1*(t-5)/Ts);% BandWidth=0.5Hz

channel_filter4=0.5/Ts*sinc(0.5*(t-5)/Ts);% BandWidth=0.25Hz

% pass the channel

signal_tr1=dt*conv(signal_tr,channel_filter1);

signal_tr2=dt*conv(signal_tr,channel_filter2);

signal_tr3=dt*conv(signal_tr,channel_filter3);

signal_tr4=dt*conv(signal_tr,channel_filter4);

signal_tr1=[0,signal_tr1];

signal_tr2=[0,signal_tr2];

signal_tr3=[0,signal_tr3];

signal_tr4=[0,signal_tr4];

% add AWGN

sigma1=sqrt(2.5*N0);

noise1=normrnd(0,sigma1,size(signal_tr1));

signal_re1=signal_tr1+noise1;

sigma2=sqrt(1*N0);

noise2=normrnd(0,sigma2,size(signal_tr2));

signal_re2=signal_tr2+noise2;

sigma3=sqrt(0.5*N0);

noise3=normrnd(0,sigma3,size(signal_tr3));

signal_re3=signal_tr3+noise3;

sigma4=sqrt(0.25*N0);

noise4=normrnd(0,sigma1,size(signal_tr4));

signal_re4=signal_tr4+noise4;

%++++++++++++++++++++++++++++++++++++++++++++++++++++

%Graphic output

%++++++++++++++++++++++++++++++++++++++++++++++++++++

% draw the transfered signal

figure(1)

plot(t(1:50*N_sample),signal_tr(1:50*N_sample))

xlabel('Time [s]')

ylabel('Transfered Signal')

axis([-1,51,1.1*min(signal_tr),1.1*max(signal_tr)])

% draw the channel filter

figure(2)

plot(t,channel_filter1)

xlabel('Time [s]')

ylabel('Channel Filter')

% signal after channel

figure(3)

plot(t(N_eye*N_sample+1:2*N_eye*N_sample),signal_tr1(N_eye*N_sample+1:2*N_eye*N_sample))

xlabel('Time [s]')

ylabel('Signal after Channel')

% eyediagram

time=0:dt:N_eye*N_sample*dt-dt;

figure(4)

subplot(4,1,1)

for n=10:1:100

buffer=signal_re1(n*N_sample*N_eye+1:(n+1)*N_sample*N_eye);

drawnow;

plot(time,buffer);

hold

on;

end

ylabel('B=2.5Hz');

subplot(4,1,2)

for n=10:1:100

buffer=signal_re2(n*N_sample*N_eye+1:(n+1)*N_sample*N_eye);

drawnow;

plot(time,buffer);

hold

on;

end

ylabel('B=1Hz');

subplot(4,1,3)

for n=10:1:100

buffer=signal_re3(n*N_sample*N_eye+1:(n+1)*N_sample*N_eye);

drawnow;

plot(time,buffer);

hold

on;

end

ylabel('B=0.5Hz');

subplot(4,1,4)

for n=10:1:100

buffer=signal_re4(n*N_sample*N_eye+1:(n+1)*N_sample*N_eye);

drawnow;

plot(time,buffer);

hold

on;

end

ylabel('B=0.25Hz');

%++++++++++++++++++++++++++++++++++++++++++++++++++++

%Over

%++++++++++++++++++++++++++++++++++++++++++++++++++++

Any problems, please contact: 516139197@qq.com

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值