All Clear All
All Clear All
close all
clear all
EbNo = 0:1:10; % Range of SNR in dB (SNR = EbNo)
EbNo_lin = 10.^(EbNo/10); % SNR in linear scale
M = 2; % Modulation scheme (M = 2 means BPSK)
m = log2(M); % Number of bits per symbol
Es = 1; % Symbol energy (it is always 1 for any
type of PSK scheme)
sigma = sqrt(Es ./ (2*m*EbNo_lin)); % Noise standard deviation (To scale the
noise accordingly)
Nbits = 1000; % Number of information bits
mcErrors = 50; % Number of maximum errors
frames = 0; % Frame count
randomMessage = 1;
bitError = zeros(size(EbNo)); % Empty vector for Bit error
totalErrors = zeros(size(EbNo)); % Empty vector for Total Error
convergence = false; % Flag to stop the simulation
while(~convergence)
if (randomMessage)
infoBits = randi([0, 1], 1, Nbits); % Random message
sequence
else
load('infoMessage.mat') % Hey there!,
would you like to go out for a drink?
end