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.

i have to calcuate the BER

Status
Not open for further replies.

abdullah gill

Member level 1
Joined
Mar 20, 2010
Messages
39
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,288
Location
pakistan
Activity points
1,503
i got the code from matlab for ofdm, i have added noise to it but unable to get the BER..... can someone help me out


%
% ------------------------
% A: Transmitter End
% ------------------------
% 1. Generate random serial data with M symbols (RANDSRC will do this)
% 2. Perform modulation (4-PSK = QPSK for now)
% 3. Serial to parallel
% 4. IFFT
% 5. Parallel to serial

% 1. Generate data
M = 4;
no_of_data_points = 64;
input = randsrc(1,no_of_data_points, 0:M-1);
figure(1)
stem(input); grid on; xlabel('Data'); ylabel('Amplitude');title('Input')

% 2. Modulation
msg_tx = pskmod(input, M);
scatterplot(msg_tx);

% 3. Serial to Parallel
parallel_mod_data = reshape(msg_tx,8,8);

% 4. 64-point IFFT
ofdm_msg = ifft(parallel_mod_data);

% 5. Parallel to serial
ofdm_msg_tx = reshape(ofdm_msg, 1,64);
figure(3)
plot(real(ofdm_msg_tx)); grid on;title('Real part of OFDM signal')
figure(4)
plot(imag(ofdm_msg_tx)); grid on;title('Imaginary part of OFDM signal')
noise_add=awgn(ofdm_msg_tx,20);
figure(6)
plot(noise_add);title('noise added in the signal')

% ---------------------
% B: Receiver End
% ---------------------

% 1. Serial to Parallel
ofdm_msg_rx = reshape(noise_add, 8,8);

% 2. 64-point FFT
msg_rx = fft(ofdm_msg_rx);

% 3. Parallel to serial
msg_rx_ser = reshape(msg_rx, 1, 64);

% 4. Demodulation
msg_demod = pskdemod(msg_rx_ser, M);
figure(5)
stem(msg_demod); grid on;title('Output')
 

hi, step three (3) at the transmitter and the receiver are not correct, because the output data from the modulator are already in parallel :) and the output data from the fft block also are in parallel shape.

you have to remove this step at the transmitter and the receiver.

regards
 

    V

    Points: 2
    Helpful Answer Positive Rating
but the step three at receiver end is converting the data from parallel to serial why should i omit that part .and what should i do to calculate BER?
 

mr abuddallah
you missing alot of concepts of doing the OFDM modualtion fft alone wont get you ofdm modualtion,
first you have to convert the data from D/A after ifft then up-convert it and transfer it to passband it(if necessary)
and to plot the BER u need to define AWGN for multipoints not only 1 point like u doing
hope this will help you
regards
 
  • Like
Reactions: sayfee

    sayfee

    Points: 2
    Helpful Answer Positive Rating
@moneer thnks for guiding to the right path but i have also defined the awgn for all paths but still the graph is not upto the expectations here is the modified code
% 1. Generate data
M = 4;
no_of_data_points = 64;
eb_n0=-3:10;
input = randsrc(1,no_of_data_points, 0:M-1);

% 2. Modulation
msg_tx = pskmod(input, M);




% 4. 64-point IFFT
ofdm_msg = ifft(msg_tx);

% 5. Parallel to serial
ofdm_msg_tx = reshape(ofdm_msg, 1,64);
for i=1:length(eb_n0)
noise_add=awgn(ofdm_msg_tx,eb_n0(i));

% ---------------------
% B: Receiver End
% ---------------------

% 1. Serial to Parallel
ofdm_msg_rx = reshape(noise_add, 8,8);

% 2. 64-point FFT
msg_rx = fft(ofdm_msg_rx);

% 3. Parallel to serial
msg_rx_ser = reshape(msg_rx, 1, 64);

% 4. Demodulation
msg_demod = pskdemod(msg_rx_ser, M);


z(i)=sum(input-msg_demod)/64;
end
plot(z)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top