from
BER vs. SNR of a binary antipodal communication system
by Sanjeet Kumar
Estimates and plots the error probability performance of a binary
antipodal communication system
|
| [p]=proberr(s)
|
function [p]=proberr(s)
E=1;
SNR=10^(s/10); % Signal to noise ratio
sgma=E/sqrt(2*SNR); % std. Deviation of Noise
N=10000;
for i=1:N, % generation of binary data source
temp=rand;
if(temp<0.5),
dsource(i)=0;
else
dsource(i)=1;
end
end;
numoferr=0; % the detection and probability of error calculation
for i=1:N,
if(dsource(i)==0) % dsource = 0
r=-E+normrnd(0,sgma); % if the source output is 0
else
r=E+normrnd(0,sgma); % if the source output is 1
end;
if(r<0),
decis=0; %decision is "0"
else
decis=1; %decision is "1"
end;
if(decis~=dsource(i)), % if decision is not equal to source bit
numoferr=numoferr+1; % if above is error then increase error content
end;
end;
p= numoferr/N; % probability of error estimate
|
|
Contact us at files@mathworks.com