Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

need help with simulation of optical ofdm in matlab

Status
Not open for further replies.

darklord1

Newbie level 1
Joined
Mar 30, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
hyderabad
Activity points
1,308
i need help with optical ofdm simulation.... i have done sim for electrical one and i m copying the code here please tell me how to change this into optical!
I need to calculate and plot the ber vs ebno

% Bit Error probability using OFDM modulation

clear 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; % random 1's and 0's
ipMod = 2*ipBit-1; % BPSK modulation 0 --> -1, 1 --> +1
ipMod = reshape(ipMod,nBitPerSym,nSym).'; % grouping into multiple symbolsa

% Assigning modulated symbols to subcarriers from [-26 to -1, +1 to +26]
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.')).';

% Appending cylic prefix
xt = [xt:),[49:64]) xt];

% Concatenating multiple symbols to form a long vector
xt = reshape(xt.',1,nSym*80);


% Gaussian noise of unit variance, 0 mean
nt = 1/sqrt(2)*[randn(1,nSym*80) + j*randn(1,nSym*80)];

% Adding noise, the term sqrt(80/64) is to account for the wasted energy due to cyclic prefix
yt = sqrt(80/64)*xt + 10^(-EsN0dB(ii)/20)*nt;

% Receiver
yt = reshape(yt.',80,nSym).'; % formatting the received vector into symbols
yt = yt:),[17:80]); % removing cyclic prefix

% converting to frequency domain
yF = (sqrt(nDSC)/nFFT)*fftshift(fft(yt.')).';
yMod = yF:),[6+[1:nBitPerSym/2] 7+[nBitPerSym/2+1:nBitPerSym] ]);

% BPSK demodulation
% +ve value --> 1, -ve value --> -1
ipModHat = 2*floor(real(yMod/2)) + 1;
ipModHat(find(ipModHat>1)) = +1;
ipModHat(find(ipModHat<-1)) = -1;

% converting modulated values into bits
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')
 

can we really "simulate" optical communication properly? especially in matlab.... I wonder. I know many have published papers using this method.

Any way, I think rather than having bipolar values, you have to transmit boolean values over the channel.... correct me if I'm mistaken. I guess this how someone had described it at edaboard.


One more thing, I had once found an ebook on "Optical communication using Matlab" or similar title on www.4shared.com

May be that can help you.

Added after 2 minutes:

Sorry, but 'your' code has striking resemblance to Krishna Sankar's code available at www.dsplog.com

If it is the same, you must acknowledge him for the code even if you have made changes to it
 

hello, thanks for the code, sorry i dont know about your problem but I want one help, Could you please explain me why you have used

EsN0dB = EbN0dB + 10*log10(nDSC/nFFT) + 10*log10(64/80);

thanks
 

well i did my BE thesis on optical OFDMA and my simulation was in matlab too.....
one thing that u should know is that Optical OFDM has to be unipolar unlike the electrical one, which is bipolar.
So, dont do the 1 --> +1 and 0 --> -1 mapping
 

can anyone please post the code for intensity modulation in optical ofdm
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top