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.

can anyone help please? i am trying to simulate the BER in OFDM

Status
Not open for further replies.

charly87

Newbie level 5
Newbie level 5
Joined
Dec 1, 2012
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,348
% the code is without the addition of the cyclic prefix. the results is not as i am expecting, can anyone help please?

clear all;
N=24;% size of fft
N1 = 6 ;% number of bits or symbols
SNR_db = [1: 20]; % multiple Eb/N0 values
SNR= 10.^(SNR_db./10);
errors = zeros(1,length(SNR_db));


%Transmitter
d = rand(1,N)>0.5; % generating 0,1 with equal probability
Signal = 2*d - 1; % BPSK modulation 0 -> -1; 1 -> 1

for k=1:N1

for i=1:length(SNR_db)
R=zeros(1,length(Signal));%Detected Signal size

x= ifft(Signal);

%for k=1:N1

%channel
W = awgn(x,SNR_db(i));


%receiver

b= fft(W);

for j=1:length(Signal)
if b(j)>=0
R(j)=1;
else
R(j)=-1;
end;
end;


errors(i) = errors(i) + size(find(Signal - R),2) ; %errors(i) + nnz(Signal-R);%number of non-zero elements

end

errors = errors./N1;

end;

BER = errors/(length(b)) ; % practical ber

a = 0.5*erfc(sqrt(SNR)); % theoretical ber

%theoretical
figure(1)
semilogy(SNR_db, a,'b.-');
hold on;

%practical
semilogy(SNR_db, BER,'or');
axis([0 20 10^-5 0.5])

hold on;
grid on;

legend('theory', 'practical');
xlabel('SNR, db');
ylabel('BER');
title('Bit error probability for ofdm using bpsk');
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top