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.

BER output problem for Radio over Fiber system/Optical Comm

Status
Not open for further replies.

thavamaran

Member level 4
Joined
Mar 2, 2009
Messages
69
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,889
Hi guys, this is my first work in optical and first simulation in matlab. I am sorry if there is mistake and im really new to this.

Here is what I did, im simulation an entire Radio Over Fiber system with Matlab, linear system.

Let me insert my code first,
Code:
%*****************************Defining constant parameter****************
%Rb = 1e+6;                  %bit rate
%Tb = 1/Rb;                  %bit duration / period
Num_bits = 1e4;             %number of bits

nsamp = 20;                 %samples per symbols
%Tsamp = Tb/nsamp;           %sampling rate, fsamp = 20MHz.
a = 0.2;                    %channel attenuation, dB/km
L = 20;                     % Length of fiber
Gain = 10;                  %Gain in dB

%*****************************Filter definations************************

snr_dB=0:20;                            %SNR in dB from 0 to 20

SNR=10.^(snr_dB./10);                   %SNR in linear scale

Tx_filter = ones(1,nsamp);              %transmitter filter, in terms of 
                                        % h(t),match filter
Rx_filter = fliplr(Tx_filter/nsamp);    % receiver filter (matched filter),
                                        % flip from left to right to make
                                        % it h(T-t), match filter

Tx_OOK = randint(1,Num_bits);           % randomly generating 1 and 0 in a 
                                        % row of matrix for 1000
                                        % column,basically ON-OFF keying
                                        % with random bits
                                        
                                        
%*****************************Channel input*****************************                                        
Tx_OOKin = 0+Tx_OOK;                    % Tx+with power, 0dBm,ideal.

%*****************************Channel properties************************
                                        
 Txch = Tx_OOKin -(a*L);                %Signal in channel, deducting with 
                                        %channel attenuation=4dB

Txout = 10.^(Txch./10);                 %Changing back the signal to linear
                                        %scale

Tx_signal = rectpulse(Txout,nsamp);     % generate rectpulse for nsamp time
                                        % per symbol
                                        
                                      
%*****************************Receiver**********************************                                        
for i=1:length(snr_dB)                                        
[b]Rx_signal = awgn(Tx_signal,snr_dB(i)+3-10*log10(nsamp),'measured'); [/b]
                                   


%*****************************Match filtering***************************
MF_out = conv(Rx_signal,Rx_filter);          %equivalent to y(t)=x(t)*h(t)

MF_out_downsamp = MF_out(nsamp:nsamp:end);   %sampling and hold



%try without truncation

%*****************************Thresholding*******************************

Rxth = zeros(1,Num_bits);               %Reset receiver before thresholding

Rxth(find(MF_out_downsamp>0.45))=1;     %value above 0.45 equivalent to one
                                        %at the receiver, thresholding.
                                        
%*****************************BER CALC**********************************
ber(i) = biterr(Tx_OOK,Rxth);           %Matlab function for ber
%******************Theoritical BER CALC**********************************
ber_pr(i) = Qfunct(sqrt(SNR(i)));       %theoritical for ber
end

figure;
semilogy(snr_dB,ber,'b');               %Simulation 
hold on;
semilogy(snr_dB,ber_pr,'r');
xlabel('SNR(dB)');
ylabel('BER');

Above is my entire code, the part i bold, i dun really get the idea, i took it from my friend cause at the receiver part, i dont really have an idea of how to receive the signal for at least with 10 different SNR rate and plot BER. My friend used the Match filter, but i dont really have the exact idea how match filter works.

The Tx_filter and Rx_filter part i got it where we flip the entire input from transmitter and at the receiver. which is h(t) from transmitter becomes h(-t).

I have uploaded the output i got where the blue line
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top