Question

In: Electrical Engineering

How to simulate BER vs SNR in matlab with increasing the number of users?

How to simulate BER vs SNR in matlab with increasing the number of users?

Solutions

Expert Solution

clc
clear all
close all
bit_count = 100000;
%no. of random bits to be generated for a single shot of BER calculation
SNR = 0: 1: 10; %Range of SNR over which to simulate
for k = 1: 1: length(SNR)
    tote = 0;
%total error bits
    totb = 0; %total bits
    while tote < 100 %until you get 100 errors
        rbits = round(rand(1,bit_count)); %generate random bits
        tx = -2*(rbits-0.5); % BPSK Modulation: Directly to Bipolar NRZ
        N0 = 1/10^(SNR(k)/10); %noise level
        rx = tx + sqrt(N0/2)*(randn(1,length(tx))+i*randn(1,length(tx)));
        rx2 = rx < 0;
% BPSK demodulator logic at the Receiver
        diff = rbits - rx2; % Calculate Bit Errors
        tote = tote + sum(abs(diff)); %total errors
        totb = totb + length(rbits); %total bits generated
    end
    BER(k) = tote / totb;
% Calculate Bit Error Rate
end
semilogy(SNR,BER,'*r');
hold on;
xlabel('Eb/No (dB)');
ylabel('BER');
title('Eb/No(SNR) Vs BER plot for BPSK Modualtion in AWGN Channel');
thber = 0.5*erfc(sqrt(10.^(SNR/10)));
% Theoretical BER
semilogy(SNR,thber);
grid on;
legend('Simulated Curve', 'Theoretical Curve');

All the best


Related Solutions

What is SNR? What factors influence SNR? What is BER? What does SNR and BER have...
What is SNR? What factors influence SNR? What is BER? What does SNR and BER have to do with each other?
Simulate using MATLAB and compare the BER of a 64-PSK system and a 64-QAM system with...
Simulate using MATLAB and compare the BER of a 64-PSK system and a 64-QAM system with Grey coding and Eb/No = 0, 2, 4, 6, 8, 10 dB. Must provide MATLAB code.
what are the reason why it is increasing the number of social media users? What are...
what are the reason why it is increasing the number of social media users? What are the effect to life, education and family of being active in social media? 500 words
write a matlab code to simulate fiber optics communication system on matlab simulink
write a matlab code to simulate fiber optics communication system on matlab simulink
Please give brief descriptions and examples with diagrams on TXCVR TYPES OF COMMON FILTERS BER VS...
Please give brief descriptions and examples with diagrams on TXCVR TYPES OF COMMON FILTERS BER VS POWER RELATIONSHIPS IN DB SCALE
How is the increasing number of megacities seen as a sustainability opportunity?
How is the increasing number of megacities seen as a sustainability opportunity?
Write a MATLAB program to simulate the Stuck in the Mud game, The following link contains...
Write a MATLAB program to simulate the Stuck in the Mud game, The following link contains the detail game description: https://www.activityvillage.co.uk/stuck-in-the-mud , with additional features that can: • Use five (5) 6-sided dice to automatically play the Stuck in the Mud game against a player. • Greet the player when the game starts. • Let the player to choose the number of rounds to play. Take care of the user input to ensure the program will not crash with inputs...
Write a MATLAB program to simulate the FIFTY dice game that can automatically play the FIFTY...
Write a MATLAB program to simulate the FIFTY dice game that can automatically play the FIFTY dice game for any amount of players, keep scores for all the players, clearly show the game progress for every round, every player, and every roll in the command window, automatically ends the game when the first player accumulates 50 points or more game score, and automatically select the game winner and the winning game score. i have coded most of the game, i...
Financial statements should be relevant for their users, yet there is increasing debate about whether they...
Financial statements should be relevant for their users, yet there is increasing debate about whether they are relevant in today's digital world. Identify and discuss four key criticisms of financial reporting based on the current IFRS standards.
Simulate the Spring Mass Damper System shown in Fig. Using MATLAB/Simulink, m being the mass of...
Simulate the Spring Mass Damper System shown in Fig. Using MATLAB/Simulink, m being the mass of Vibrating System in Kg. c Being the coefficient of damping in N-sec/m, K being spring stiffness in N/m. For the values m=15kg C=100 N-sec/m k=200 N/m mx''+cx'+kx=f0sinwt
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT