gusucode.com > UWB_matlab源码程序 > CP0602/cp0602_max_distance.m

    %
% FUNCTION 6.3 : "cp0602_max_distance"
%
% Maximum distance between transmitter and receiver for a
% M-PAM UWB signal as a function of the signal PSD and the
% path loss, based on Eq. (6-27)
%
% The function receives as input the antenna gains 'Gt' and 
% 'Gr', the frequency vector 'f' in the range of interest
% [fL, fH], the transmitted PSD in the same frequency range
% 'PSD', the link margin in linear units 'Margin', the bit
% period 'Tb', the noise unilateral PSD N0, and the Eb/N0
% value 'Eb_N0'
%
% The function returns as output the maximum distance
% between transmitter and receiver for the given rate and
% Eb/N0 
%
% Programmed by Luca De Nardis

function D = cp0602_max_distance(Gt, Gr, f, PSD,...
   Margin, Tb, N0, Eb_N0)
c = 3e8;                                % Light speed [m/s] 
free_space_term =  (Gt * Gr * c^2) / (16 * pi^2);
frequency_term = sum(PSD./(f.^2))*(f(length(f))-...
   f(1))/length(f);
D = sqrt((free_space_term * frequency_term * Tb) /...
   (Margin * Eb_N0* N0));