0% found this document useful (0 votes)
14 views1 page

WC Exp4

diversity code

Uploaded by

poojas.ph22.ec
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views1 page

WC Exp4

diversity code

Uploaded by

poojas.ph22.ec
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

BER Analysis for OFDM MIMO using Rayleigh Fading Channel;

clear all;
close all;

nFFT = 64; % fft size


nDSC= 52; % Number of data subcarriers
nBitPerSym = 52; % Number of bits per OFDM symbol (same as the number of
subcarriers for BPSK)
nSym = 10^4; % Number of symbols
EbN0dB = [0:10]; % 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 = rand(1,nBitPerSym*nSym) > 0.5;
ipMod = 2*ipBit-1;
ipMod =reshape(ipMod,nBitPerSym,nSym).';
% Grouping into multiple symbols
xF=[zeros(nSym,6) ipMod(:,1:nBitPerSym/2) zeros(nSym,1)
ipMod(:,nBitPerSym/2+1:nBitPerSym) zeros(nSym,5)] ;
xt = (nFFT/sqrt(nDSC))*ifft(fftshift(xF.')).';
xt = [xt(:,49:64) xt];
xt = reshape(xt.',1,nSym*80);
nt = 1/sqrt(2)*(randn(1,nSym*80) + 1i*randn(1,nSym*80));
yt = sqrt(80/64)*xt + 10^(-EsN0dB(ii)/20)*nt;
% Receiver
yt = reshape(yt.',80,nSym).';
yt = yt(:,17:80);
yF = (sqrt(nDSC)/nFFT)*fftshift(fft(yt.')).';
yMod = yF(:,[6+(1:nBitPerSym/2) 7+[nBitPerSym/2+1:nBitPerSym] ]);
% +ve value --> 1, -ve value --> -1
ipModHat = 2*floor(real(yMod/2)) + 1;
ipModHat(ipModHat>1) = +1;
ipModHat(ipModHat<-1)= -1;
ipBitHat = (ipModHat+1)/2;
ipBitHat = reshape(ipBitHat.',nBitPerSym*nSym,1).';
% Counting the errors
nErr(ii) = size(find(ipBitHat - ipBit),2);
end

simBer = nErr/(nSym*nBitPerSym);
theoryBer = (1/2)*erfc(sqrt(10.^(EbN0dB/10)));
close all;
figure;
semilogy(EbN0dB,theoryBer,'bs-','LineWidth',2);
hold on;
semilogy(EbN0dB,simBer,'mx-','LineWidth',2);
axis([0 10 10^-5 1])
grid on;
legend('theory','simulation');
xlabel('Eb/No,dB');
ylabel('Bit Error Rate');
title('Bit error probability curve for BPSK using OFDM');

You might also like