Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

i want to add fading to this code. how is it done please? Thanks very much

Status
Not open for further replies.

charly87

Newbie level 5
Joined
Dec 1, 2012
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,348
clear all;
N = 10^6 ;% number of bits or symbols
SNR_db = [0: 25]; % multiple Eb/N0 values
SNR= 10.^(SNR_db./10);

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


for i = 1:length(SNR_db)
w = awgn(Signal,SNR_db(i),-3);

%decision

%errors(i)= zeros(errors);
errors(i)= nnz(Signal.*w <0); % counting errors

end
BER = errors/N; % practical ber
a = 0.5*erfc(sqrt(SNR)); % theoretical ber

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

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

hold on;
grid on;

legend('theory', 'practical');
xlabel('SNR, db');
ylabel('BER');
title('Bit error probability for BPSK over AWGN channel');
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top