gusucode.com > UWB_matlab源码程序 > CP0902/cp0902_prbcoll.m

    %
% Function 9.5: "cp0902_prbcoll"
%
% Evaluates the probability of error
% on the basis of the probability 
% of pulse collision
%
% 'Nu' is the number of users
% 'Ns' is the number of pulses per bit
% 'Tm' is the time duration of the pulse
% 'Ts' is the average pulse repetition period
%
% 'Prb' is the estimated bit error probability
% 
% Programmed by Guerino Giancola
%

function [Prb] = cp0902_prbcoll(Nu,Ns,Tm,Ts)

% --------------------------------------------------
% Step One - Evaluation of the bit error probability
% --------------------------------------------------


% Probability of collision
pr_pulsecollision = 1 - exp((2-2*Nu)*Tm/Ts);

% Probability of error for the single pulse
pr_pulseerror = 0.5 * pr_pulsecollision;

% Probability of error for the bit
n_min = ceil(Ns/2);
n_max = Ns;
Prb = 0;
for n = n_min : n_max
    
    tmp = nchoosek(Ns,n)*(pr_pulseerror^n)*((1-pr_pulseerror)^(n_max-n));
    Prb = Prb + tmp;
    
end % for n = n_min = n_max