Sign in

username:

password:



Not a member?

Search matlab



Search tips

Subscribe to matlab



matlab by Keywords

Atanh | Autocorrelation | Bandpass Filter | C++ | Conv | Database | Deconv | Excel | FFT | Filter | Filtering | FIR | Fourier Transfrom | FSK | Gaussian Noise | Haykin | IFFT | Image | Java | LFSR | LMS | LPC | MEX | OFDM | QPSK | Radix | Random | Sampling | Segmentation | Simulink | Visual Basic | Waveform | Wavelet


Discussion Groups

Discussion Groups | Matlab DSP | simulation of ofdm with QPSK in Rayleigh channel

Technical discussion about Matlab and issues related to Digital Signal Processing.

  

Post a new Thread

simulation of ofdm with QPSK in Rayleigh channel - dece...@yahoo.com - Sep 29 7:24:37 2008



hi;
i have simulated a general ofdm system but i am not having correct results. can any one rectify
problems in this code. have i used correct formulas in this code? i mean does RAYLEIGHCHAN
command hold for it? do i need to equalize the receiver signal? if so then how and at what
stage? and have i used right command for theoritical BER of OFDM in Rayleigh channel?

% Script for computing the BER for PSK in OFDM modulation in the 
% presence of Rayeligh fading channel

clear all
nFFT        = 64; % fft size
nDSC        = 32; % number of data subcarriers
nBitPerSym  = 32; % number of bits per OFDM symbol (same as the number of subcarriers)
nSym        = 10^2; % number of symbols
M           = 4;    % qpsk modulation
CP=16; % no. of CP samples
EbN0dB      = [0:5:30]; % bit to noise ratio
EsN0dB      = EbN0dB + 10*log10(nDSC/nFFT) + 10*log10(64/80); 
% converting to symbol to noise ratio

for ii = 1:length(EbN0dB)
 
   % Transmitter
   ipBit = randint(1,nBitPerSym*nSym,M); % random 1's and 0's
   ipMod = pskmod(ipBit,M);
   ipMod = reshape(ipMod,nSym,nBitPerSym); % grouping into multiple symbols
   % Assigning modulated symbols to subcarriers from [-16 to -1, +1 to +16]
   xF = [zeros(nSym,6) ipMod(:,[1:nBitPerSym/2]) zeros(nSym,1)
ipMod(:,[nBitPerSym/2+1:nBitPerSym]) zeros(nSym,5)] ;
   
   % Taking FFT, the term (nFFT/sqrt(nDSC)) is for normalizing the power of transmit symbol to
1 
   xt = (nFFT/sqrt(nDSC))*ifft(fftshift(xF.'),nFFT).';
 
   % Appending cylic prefix 16 samples
   xt = [xt(:,[end-CP:end]) xt];
 
   % multipath channel
   xt = reshape(xt.',1,prod(size(xt)));
   ht=rayleighchan(1/1000,100,.0001,5);
   xt=filter(ht,xt);
 
 % Gaussian noise of unit variance, 0 mean
nt = 1/sqrt(2)*[randn(1,prod(size(xt))) + j*randn(1,prod(size(xt)))];
 
% Adding noise, the term sqrt(80/64) is to account for the wasted energy due to cyclic prefix
   yt = sqrt(60/44)*xt + 10^(-EsN0dB(ii)/20)*nt;
 
   % Receiver
 % formatting the received vector into symbols
  yt = reshape(yt,nSym,length(yt)/nSym);
  yt = yt(:,[CP+1:end]); % removing cyclic prefix
 
   % converting to frequency domain
   yF = (sqrt(nDSC)/nFFT)*fftshift(fft(yt.')).'; 
 
   % extracting the required data subcarriers
   yMod = yF(:,[6+[1:nBitPerSym/2] 7+[nBitPerSym/2+1:nBitPerSym] ]); 
 
   % PSK demodulation
 
rx_ipBit = pskdemod(yMod,M);
rx_ipBit = reshape(rx_ipBit.',nBitPerSym*nSym,1).';
 
   % counting the errors
[nErr(ii) ber(ii)]=biterr(ipBit,rx_ipBit);
theoryBer = berfading(EbN0dB,'psk',2,1);
end
 
close all; figure
semilogy(EbN0dB,theoryBer,'b.-');hold on
semilogy(EbN0dB,ber,'r.:');grid on
legend('Rayleigh-Theoritical BER', 'Rayleigh-Simulated BER');
xlabel('Eb/No, dB');ylabel('Bit Error Rate');
title('BER for QPSK using OFDM in Rayleigh channel');



(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )