nrz matlab程序,数字通信原理NRZNRZI,MILLER码的MATLAB编程.docx

数字通信原理NRZNRZI,MILLER码的MATLAB编程

SIMULATION AND PERFORMANCEANALYSIS OFBASEBANDTRANSMISSION1. Generate a random binary sequence with 1000 bits, in which theprobability of “0” is 0.8 and the probability of “1” is 0.2, respectively.Code:>> NRZ=randsrc(1,1000,[1,0;0.2,0.8])2. Plot the first 20 bits of the binary sequence as the NRZ signals.>> fori=1:20NRZ_plot(i)=NRZ(i);end>> figure(1);subplot(3,1,1)>> stairs(NRZ_plot)3. Transfer the random binary sequence to the NRZI signals and Millercodes. Plot the first 20 bits of the NRZI and Miller Code waveforms.The waveform sampling rate is set to 8 times the symbol rate (oversamplingrate equals to 8).>> fori=1:1:999;NRZI(i+1)=NRZ(i+1)-NRZ(i);if(NRZI(i)==-1);NRZI(i)=1;NRZI(1)=NRZ(1);end;end;>>for i=1:19NRZI_plot(i)=NRZI(i);endstairs(NRZI_plot);miller=rand(1,8*k);%get the miller codefori=1:kif NRZ(i)==1%when the nrz==1ifi==1%the initialization when nrz==1for j=0:3miller(8*i-7+j)=1;endfor j=4:7miller(8*i-7+j)=0;endelse%the normal situation when nrz==1for j=0:3miller(8*i-7+j)=miller(8*i-8);endfor j=4:7miller(8*i-7+j)=1-miller(8*i-8);endendelse%when the NRZ==0ifi==1%the initialization when nrz==0for j=0:7miller(8*i-7+j)=0;endelseif NRZ(i-1)==1%when the front one is 1for j=0:7miller(8*i-7+j)=miller(8*i-8);endelse%when the front one is 0for j=0:7miller(8*i-7+j)=1-miller(8*i-8);endendendend;fori=1:160miller_plot(i)=miller(i);end;%subplot(3,1,3);stairs(miller_plot);>> subplot(3,1,1);>> stairs(NRZ_plot);>> subplot(3,1,2);>> stairs(NRZI_plot);>> subplot(3,1,3);>> stairs(miller_plot)4. Estimate the power spectrums of these different baseband signalsand plot them. Pay attention to the differences between these powerspectrums.The code:fori=1:1000for k=0:7nrz(8*i-k)=NRZ(i);nrzi(8*i-k)=NRZI(i);endendnrzfft=fft(nrz);%get the fft of nrzsubplot(3,1,1);plot(abs(nrzfft).^2);%plot the power spectrum of nrzaxis([0 8000 0 350000]);nrzifft=fft(nrzi);%get the fft of nrzisubplot(3,1,2);plot(abs(nrzifft).^2);%plot the power spectrum of nrziaxis([0 8000 0 350000]);millerfft=fft(miller);%g

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值