% SS_PE96 finds the measured error rate. The value of
% signal per interference ratio in dB is given as an
% input to the function.
Eb=rho; % energy per bit
alpha=2/rho; % optimal alpha if rho>2
alpha=1; % optimal alpha if rho<2
sgma=sqrt(1/(2*alpha)); % noise standard deviation
N=10000; % number of bits transmitted
% generation of the data sequence
% Find the received signals.
% the transmitted signal
% The received signal is found by adding noise with probability alpha.
% Make the decisions and count the number of errors made.
r1=r1c(i)^2+r1s(i)^2; % first decision variable
r2=r2c(i)^2+r2s(i)^2; % second decision variable
% Decision is made next.
% Increment the counter if this is an error.
% measured bit error rate is then