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
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...
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
Hi, I'm currently writing a Matlab program to simulate the Apollo 11 trajectory. Now I want...
Hi, I'm currently writing a Matlab program to simulate the Apollo 11 trajectory. Now I want to plot a 3D animated orbit which is a 60 by 58 nautical miles orbit. Can you provide a code or some idea of how to plot an orbit like this in 3D?
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.
The marketing department for BER Inc. has been struggling with how they will spend their advertising...
The marketing department for BER Inc. has been struggling with how they will spend their advertising budget in the coming year. You have been requested to make a recommendation. You have been provided the monthly values for net sales (SALES), and advertising expenditures for mailings (MAIL), print(PRINT), and billboards (BB) along with their sum (TOTAL = MAIL+ PRINT + BB), in the file BER.JMP, covering the months from July 2014 through June 2020. Your assignment is to evaluate the effectiveness...
Is the number of tornadoes increasing? In the last homework, data on the number of tornadoes...
Is the number of tornadoes increasing? In the last homework, data on the number of tornadoes in the United States between 1953 and 2014 were analyzed to see if there was a linear trend over time. Some argue that it’s not the number of tornadoes increasing over time, but rather the probability of sighting them because there are more people living in the United States. Let’s investigate this by including the U.S. census count (in thousands) as an additional explanatory...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT