Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

OFDM symbol generation

It occurred to me that this Matlab code snippet may be helpful for those of us working on testing implementations of OFDM/COFDM carrier based systems, I had already posted this on dsprelated.com as well:

It generates vector tx, made up of ofdm symbols. You can change modulation scheme to any of qpsk,16qam or 64qam.

With some effort, you can also change the bandwidth to suit your case.

The output scaling is not normalised, you can adjust it at will.


%bandwidth = 1200/2048 of sampling frequency
clear all;
nData = 100832;                %vector length
ModulationType = '64QAM';
nFFT = 2048;                   %fft size
nCar = 1200;                   %number of active carriers
nPrefix = 144;
        
%compute number of ofdm symbols  
nSymbols = ceil(nData/(nFFT+nPrefix)); 
    
%generate random data symbols
switch ModulationType                              
    case 'QPSK',  alphabet = ; 
    case '16QAM', alphabet = ; 
    case '64QAM', alphabet = ; 
end
    
tx = ;
for k = 1:nSymbols     
   QAM = complex(randsrc(nCar,1,alphabet),randsrc(nCar,1,alphabet));
  
   fft_in = zeros(1,nFFT);
   fft_in(1:600) = QAM(1:600);
   fft_in(end-600+1:end) = QAM(601:end);
   fft_out = ifft(fft_in);
   
   %concatenate ofdm symbol plus its prefix into tx vector 
   prefix = fft_out(nFFT-nPrefix+1:nFFT);           
   tx = ;
end
No RepliesBe the first to reply