ofdm_continu_vs_ifft.m
上传用户:m_sun_001
上传日期:2014-07-30
资源大小:1115k
文件大小:4k
源码类别:

matlab例程

开发平台:

Matlab

  1. %DVB-T 2K signal generation Eq. (2.1.4) vs. 2N-IFFT
  2. %本段程序主要进行(2。1。4)连续调制方式下的OFDM调制与IFFT方式下的OFDM调制的对比试验
  3. clear all;
  4. close all;
  5. %------------------------------------系统参数-----------------------------------------------------------------
  6. Tu=224e-6;                                                                      %useful OFDM symbol period
  7. T=Tu/2048;                                                                      %baseband elementary period
  8. G=0;                                                                            %choice of 1/4, 1/8, 1/16, and 1/32
  9. delta=G*Tu;                                                                     %guard band duration
  10. Ts=delta+Tu;                                                                    %total OFDM symbol period
  11. Kmax=1705;                                                                      %number of subcarriers
  12. Kmin=0;
  13. FS=4096;                                                                        %IFFT/FFT length
  14. q=10;                                                                           %carrier period to elementary period ratio
  15. fc=q*1/T;                                                                       %carrier frequency
  16. Rs=4*fc;                                                                        %simulation period
  17. %-----------------------------------产生调制数据--------------------------------------------------------------
  18. M=Kmax+1;
  19. a=-1+2*round(rand(M,1)).'+i*(-1+2*round(rand(M,1))).';                          %产生调制数据(QAM映射)
  20. A=length(a);                                                                    %调制数据长度
  21. info = [ a.'];                                                                  %所产生数据赋值info
  22. tt=0:1/Rs:Ts;                                                                   %产生连续时间因子(采样率为4fc,总长度为一个符号周期,包括保护间隔)
  23. TT=length(tt);                                                                  %时间因子总长度
  24. k=Kmin:Kmax;                                                                    %子载波下标
  25. %-----------------------------------按照(2。1。4)式多载波调制-----------------------------------------------
  26. for t=0:(TT-1)                                                                  % Eq. (2.1.4)按照参考文献中的(2。1。4)式
  27.     phi=a(k+1).*exp((1j*2*(((t*(1/Rs))-delta))*pi/Tu).*((k-(Kmax-Kmin)/2)));    %对调制信号a进行多载波调制(模拟连续情况,采样率为4fc)
  28.     s(t+1)=real(exp(1j*2*pi*fc*(t*(1/Rs))).*sum(phi));                          %调制过程包括了上变频,调制到fc
  29. end                                                                             %在这个循环体中,可能时间参量t的设置有问题,t应该与tt一致才对
  30. %----------------------------------采用IFFT/FFT进行OFDM调制---------------------------------------------------
  31. infof=zeros(FS,1);                                                              %对调制信号首先赋零,长度为4096
  32. infof(1:(A/2)) = [ a(1:(A/2)).'];                                               %对前1706/2个调制信号赋值
  33. infof((FS-((A/2)-1)):FS) = [ a(((A/2)+1):A).'];                                 %对后1706/2个调制信号赋值
  34. carriers=FS.*ifft(infof,FS);                                                    % 采用IFFT方式完成OFDM调制
  35. %-----------------------------------------Upconverter---------------------------------------------------------
  36. L = length(carriers);                                                           %完成OFDM调制后的信号的长度
  37. chips = [ carriers.';zeros((2*q)-1,L)];                                         %以下四句完成对调制后信号的连续化
  38. p=1/Rs:1/Rs:T/2;
  39. g=ones(length(p),1);
  40. dummy=conv(g,chips(:));
  41. u=[dummy(1:TT)];
  42. [b,a] = butter(13,1/20);                                                        %设计低通滤波器
  43. uoft = filter(b,a,u);                                                           %连续化后的信号过低通滤波器,完成D/A转换
  44. s_tilde=(uoft.').*exp(1i*2*pi*fc*tt);                                           %上变频,调制到载波fc上
  45. sf=real(s_tilde);                                                               %完成上变频的信号sf
  46. figure(1);
  47. plot(tt,s,'b',tt,sf,'g');                                                       %画出以(2。1。4)实现的调制和以IFFT完成的调制的对比图
  48. figure(2);
  49. pwelch(s,[],[],[],Rs);                                                          %给出两种调制方式下信号的功率谱
  50. hold on;
  51. pwelch(sf,[],[],[],Rs);
  52. hold off;