QPSK调制解调完整程序配有自己的注释知识分享_第1页
QPSK调制解调完整程序配有自己的注释知识分享_第2页
QPSK调制解调完整程序配有自己的注释知识分享_第3页
QPSK调制解调完整程序配有自己的注释知识分享_第4页
QPSK调制解调完整程序配有自己的注释知识分享_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、QPSK调制解调完整程序配有自己的注释QPS咽制解调完整程序(配有注释)clc;clear all;%贸定接收端已经实现载波同步,位同步(盲信号解调重点要解决的问题:载波同步(costas环(未见到相关代码),位同步(Gardner算法(未见相关代码),帧同步)% carrier frequency for modulation and demodulation fc=5e6;%QPSK transmitterdata=5000;涮数率为5MHZ %M码个数rand_data=randn(1,5000);for i=1:dataif rand_data(i)>=0.5rand_data(

2、i)=1;elserand_data(i)=0; endend%seriel to parallel%同时单极性码转为双极性码for i=1:dataif rem(i,2)=1if rand_data(i)=1I(i)=1;I(i+1)=1; elseI(i)=-1;I(i+1)=-1; end elseif rand_data(i)=1Q(i-1)=1;Q(i)=1;elseQ(i-1)=-1;Q(i)=-1;endendend% zero insertion,此过程称为成形.成形的意思就是实现由消息到波形的转换,以便发射,脉冲成形应该是在基带调制之后.zero=5;%sampling ra

3、te 25M HZ ,明白了,zero 为过采样率.它等于 采样率fs/码速率.for i=1:zero*data%采样点数目=过采样率*原码数目if rem(i,zero)=1Izero(i)=Ifix(i-1)/zero)+1);Qzero(i)=Q(fix(i-1)/zero)+1);elseIzero(i)=0;Qzero(i)=0;endend%pulse shape filter ,接着,将进行低通滤波,由于随着传输速率的增大,基带脉冲的频谱将变宽呦口果不滤波(如升余弦滤波)进行低通滤波,后面加载频的时候可能会出现困难.%¥方根升余弦滤波器% psf=rcosfir(rf

4、,n_t,rate,fs,'sqrt')rate:过采样率,rf:滚降因子,n_t:滤波器阶数,fs:采样率%用在调制或发送之前,用在解调或接受之后,用来降低过采样符号流带宽并不引发ISI (码问串扰)NT=50;N=2*zero*NT; % =500fs=25e6;大小为500rf=0.1;psf=rcosfir(rf,NT,zero,fs,'sqrt');% psf Ipulse=conv(Izero,psf);Qpulse=conv(Qzero,psf);%为什么数字信号传输也要过采样,成形滤波?%答:过采样的数字信号处理起来对低通滤波器的要求相对较低,如

5、果不过采样,滤波的时候滤波器需要很陡峭,指标会很严格%成形滤波的作用是保证采样点不失真.如果没有它,那信号在经过带限信道后,眼图张不开,ISI非常严重.成形滤波的位置在基带调制之后.%由于经成形滤波后,信号的信息已经有所损失,这也是为防止ISI付出的代价.换句话说,成形滤波的位置在载波调制之前,仅挨着载波调制.%W:(发送端)插值(采样)-成形-滤波(LPF)-加载频(载波调制)-加噪声至(接收端)乘本振-低通-定时抽取-判决.%modulationfor i=1:zero*data+N%:样点数目改变(由于卷积的缘故)t(i)=(i-1)/(fs);溢里由于假设载频与码速率大小相等,所以用载

6、频fc乘以过采样率=采样率.Imod(i)=Ipulse(i)*sqrt(2)*cos(2*pi*fc*t(i);Qmod(i)=Qpulse(i)*(-sqrt(2)*sin(2*pi*fc*t(i); end sum=Imod+Qmod; %QPSK receiver %demodulation for i=1:zero*data+NIdem(i)=sum(i)*sqrt(2)*cos(2*pi*fc*t(i);Qdem(i)=sum(i)*(-sqrt(2)*sin(2*pi*fc*t(i); end %matched filter mtf=rcosfir(rf,NT,zero,fs,&

7、#39;sqrt');Imat=conv(Idem,mtf);Qmat=conv(Qdem,mtf); %data selection for i=1:zero*dataIsel(i)=Imat(i+N);Qsel(i)=Qmat(i+N);end%sampler%提取码元for i=1:dataIsam(i)=Isel(i-1)*zero+1);Qsam(i)=Qsel(i-1)*zero+1); end %decision threshold threshold=0.2; for i=1:data if Isam(i)>=threshold Ifinal(i)=1; else

8、Ifinal(i)=-1;end if Qsam(i)>=thresholdQfinal(i)=1; elseQfinal(i)=-1; end end %parallel to serial for i=1:data if rem (i,2)=1if Ifinal(i)=1 final(i)=1;else final(i)=0;end elseif Qfinal(i)=1 final(i)=1;else final(i)=0;end endend%绘图figure(1)plot(20*log(abs(fft(rand_data); axis(0 data -40100);grid on

9、;title('spectrum of input binary data');figure(2)subplot(221);plot(20*log(abs(fft(I);axis(0 data -40 140);grid on;title('spectrum of I-channel data');subplot(222);plot(20*log(abs(fft(Q);axis(0 data -40140);grid on;title('spectrum of Q-channel data');subplot(223);plot(20*log(a

10、bs(fft(Izero);axis(0 zero*data -20140);grid on;title('spectrum of I-channel after zero insertion');subplot(224);plot(20*log(abs(fft(Qzero);axis(0 zero*data -20 140);grid on;title('spectrum of Q-channel after zero insertion');figure(3);subplot(221);plot(psf);axis(200300-0.20.6);title(

11、'time domain response of pulse shaping filter');grid on;subplot(222);plot(20*log(abs(fft(psf);axis(0 N -350 50);grid on;title('transferfunction of pulse shaping filter');subplot(223);plot(20*log(abs(fft(Ipulse);axis(0 zero*data+N -250 150);grid on;title('spectrum of I-channel aft

12、er subplot(224);plot(20*log(abs(fft(Qpulse);axis(0 zero*data+N -250 grid on;title('spectrum of Q-channelimpulse shaping filter');150);after pluse shapingfilter');figure(4)subplot(211);plot(20*log(abs(fft(Imod);axis(0 zero*data+N grid on ;title('spectrum of I-channel subplot(212);plot

13、(20*log(abs(fft(Qmod);axis(0 zero*data+N grid on;-250 150);after modulation');-250 150);title('spectrumofQ-channel after modulation');figure(5)subplot(221);plot(20*log(abs(fft(Idem);axis(0 zero*data grid on;title('spectrum subplot(222);-200150);of I-channel afterdemodulation');pl

14、ot(20*log(abs(fft(Qdem);axis(0 zero*data+N -200150 );grid on;title('spectrum of Q-channel after demodulation');subplot(223);plot(20*log(abs(fft(Imat);200);axis(0 zero*data -400 grid on;title('spectrum subplot(224);of I-channelaftermatched filter');plot(20*log(abs(fft(Qmat);title('

15、;spectrum of200);axis(0 zero*data -400 grid on;Q-channel after matched filter');figure(6)subplot(221);plot(20*log(abs(fft(Isam);axis(0 data-40150);grid on;title('spectrum of I-channel after sampler');subplot(222);plot(20*log(abs(fft(Qsam);axis(0 data -40150 );grid on;title('spectrum

16、of Q-channel aftersampler');subplot(223);plot(20*log(abs(fft(Ifinal);axis(0 data -40150);grid on;title('spectrum ofI-channel after decision threshold');subplot(224);plot(20*log(abs(fft(Qfinal);axis(0 data -40150);grid on;title('spectrum ofQ-channel afterdecision threshold');title('constellationofmatchedfigure(8)plot(Isam,Qsam,'X');axis(

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论