Generation of an OFDM signal
The modulator and demodulator in an OFDM system are usually implemented by use
of a parallel bank of tuned filters based on the discrete Fourier Transform (DFT). To
demonstrate this implementation, let us consider an OFDM modulator that generates
K independent subcarriers, where each subcarrier is modulated by symbols selected
from a QAM signal constellation.
Matlab Coding
1 % MATLAB script for Illustrative Problem 8.2. 2 echo on 3 clear; 4 K=10;N=2*K;T=100; 5 a=rand(1,36); 6 a=sign(a-0.5); 7 b=reshape(a,9,4);
8 % Generate the 16QAM points 9 XXX=2*b(:,1)+b(:,2)+j*(2*b(:,3)+b(:,4)); 10 XX=XXX'; 11 X=[0 XX 0 conj(XX(9:-1:1))]; 12 xt=zeros(1,101); 13 for t=0:100 14 for k=0:N-1 15 xt(1,t+1)=xt(1,t+1)+1/sqrt(N)*X(k+1)*exp(j*2*pi*k*t/T); 16 echo off 17 end 18 end 19 echo on 20 xn=zeros(1,N); 21 for n=0:N-1 22 for k=0:N-1 23 xn(n+1)=xn(n+1)+1/sqrt(N)*X(k+1)*exp(j*2*pi*n*k/N); 24 echo off 25 end 26 end 27 echo on 28 pause % press any key to see a plot of x(t) 29 plot([0:100],abs(xt))
30 % Check the difference between xn and samples of x(t) 31 for n=0:N-1 32 d(n+1)=xt(T/N*n+1)-xn(1+n); 33 echo off 34 end 35 echo on 36 e=norm(d); 37 Y=zeros(1,10); 38 for k=1:9 39 for n=0:N-1 40 Y(1,k+1)=Y(1,k+1)+1/sqrt(N)*xn(n+1)*exp(-j*2*pi*k*n/N); 41 echo off 42 end 43 end 44 echo on 45 dd=Y(1:10)-X(1:10); 46 ee=norm(dd);
>> ee
ee =
1.7359e-14
>> e
e =
4.1301e-14
Reference,
1. <<Contemporary Communication System using MATLAB>> - John G. Proakis