Forums

OFDM Transceiver

Started by mohamed hussien June 6, 2008
Hi
I want to do a program for OFDM transceiver and add
all the channel effects and measure all the OFDM
parameters. Can any one help me to complete this
program? Check the following program and help me to
complete it.
Regards

clear all;
close all;
clc;
%======================================================================= % OFDM System Parameters
N = 64; % length of OFDM IFFT
(16,32,64,...,2^n)
M = 16; % number of QAM constellation
points (4,16,64,256)
numOfZeros = N/4+1; % numOfZeros must be an odd
number and lower
% than N. The zero padding
operation is
% necessarry in practical
implementations.
GI = 1/4; % Guard Interval
(1/4,1/8,1/16,...,4/N)
BW = 20; % OFDM signal Band width in
MHz
numOfSym = 128; % number of OFDM Symbols
EbNo = [0:20];
den = 1;
num = ones(16,1)/16;
%===========================================================% Main Program
%============================================================= % data generation randint
txData = randint(N-numOfZeros,numOfSym,M,0);
%reset it to zero state
% QAM modulation
txDataMod = qammod(txData,M);
% it should be multiplied by sqrt(10) when compared
with qamdemod but
% for the sake of semianalytic ber approach you need
to keep it like that.
mean(abs(txDataMod(:,2)).^2); % must be 1 i.e. the
average power
% zeros padding
txDataZpad [txDataMod((N-numOfZeros+1)/2:end,:);...
zeros(numOfZeros,numOfSym);...
txDataMod(1:(N-numOfZeros-1)/2,:)];
% Note : in practice zero padding operation must
be followed by
% a standard. Usually the last part of data frame
shifts to the first
% part of zero padded frame.

%===========================================================
% IFFT
txDataZpadIfft = sqrt(N)*ifft(txDataZpad,N);

%============================================================= % Apply windowing function to each time domain
waveform
for i = 1:64
%txDataZpadIfft1(i,:) txDataZpadIfft(i,:)).*hamming(N)';
txDataZpadIfft1(i,:) = txDataZpadIfft(i,:);
end
% Guard Interval Insertion
txDataZpadIfftGI [txDataZpadIfft1((1-GI)*N+1:end,:);txDataZpadIfft];
%cp insertion
% ========= receiver part ====================== % Guard Interval removal
rxDataZpadIfft = txDataZpadIfftGI(GI*N+1 :
N+GI*N,:);

%========================================================= % FFT operation
rxDataZpad = 1/sqrt(N)*fft(rxDataZpadIfft,N);

%============================================================= % zero removal and rearrangement
rxDataMod [rxDataZpad((N-(N-numOfZeros-1)/2+1):N,:);...

rxDataZpad(1:(N-numOfZeros+1)/2,:)];
% demodulation
rxData =qamdemod(rxDataMod*sqrt(10),M);
% rxData qamdemod(rxDataMod/mean(std(rxDataMod))*mean(std(txDataMod)),M);
%============================================================ txDataZpadIfftGI1 = reshape(txDataMod,1,6016);
% you cannot use txDataZpadIfftGI or txDataSig those
are zero paded and ifft/fft formed
% so you care only about qam modulated data whixh is
txDataMod
rxDataMod1 = reshape(rxDataMod,1,6016);
ber1 semianalytic(txDataZpadIfftGI1,rxDataMod1,'qam',M,numOfSym*12,EbNo);
%increase the sampling to be sufficient
% no need for num,den because it wouldnot work here
%
bertheory = berawgn(EbNo,'qam',M);
%========================================================figure(1)
semilogy(EbNo,ber1,'-b'); grid on; hold on;
semilogy(EbNo,bertheory,'-m');
title('BER for OFDM, and Theory');
axis([0 14 0.0001 1]);
xlabel('EbNo (dB)'); ylabel('BER');
legend('OFDM','THEORY');
hold off;
%========
Mohamed Hussien Mohamed
University Technology PETRONAS