?? cp0602_link_budget.m
字號:
%
% FUNCTION 6.2 : "cp0602_link_budget"
%
% Link budget for M-PAM and M-PPM UWB signals
%
% The function performs the link budget for an M-PAM and an
% M-PPM UWB signal for M = {2, 4, 8} and plots the maximum
% distance between transmitter and receiver as a function
% of data rate
%
% The function receives as input the antenna gains 'Gt' and
% 'Gr', the link margin in dB 'MargindB', the noise factor
% in dB 'FdB', the frequency vector 'f' in the range of
% interest [fl, fh], the transmitted PSD in the same
% frequency range 'PSD', and the requested symbol error
% probability 'Pre'
%
% The function returns as output a matrix containing the
% maximum distance for each value of M as a function of the
% rate Rb
%
% Programmed by Luca De Nardis
function [dist_PAM, dist_PPM] =cp0602_link_budget(Gt,...
Gr, MargindB, FdB, f, PSD, Pre)
% --------------------------
% Step Zero - Initialization
% --------------------------
dist=zeros(3,19);
Rb=linspace(20e6,200e6,19); % values of the bit rate
M = [2 4 8]; % values of M
F = 10^(FdB/10); % conversion of the noise
% factor to linear units
Margin = 10^(MargindB/10); % conversion of the link
% margin to linear units
k = 1.38e-23; % Boltzmann constant [J/K]
T0 = 300; % standard temperature [K]
N0 = F*k*T0; % noise unilateral PSD [W/Hz]
% ----------------------------------------------
% Step One - Evaluation of maximum distance
% ----------------------------------------------
Eb_N0 = logspace(0.5,2); % range of Eb/N0: 5-20 dB
for i=1:3
% Evaluation of the EB/N0 for the two cases, M-PAM and
% M-PPM
% from Eqs.(6.31) and (6.33)
Pr_M_PAM = 1;
Pr_M_PPM = 1;
j=1;
while Pr_M_PAM > Pre
Pr_M_PAM =(1-1/M(i))*erfc(sqrt(Eb_N0(j) * 3 *...
log2(M(i))/(M(i)^2-1)));
Eb_N0_PAM = Eb_N0(j);
j=j+1;
end
j=1;
while Pr_M_PPM > Pre
Pr_M_PPM = exp(-0.5 * log2(M(i))*(Eb_N0(j) - 2 *...
log(2)));
Eb_N0_PPM = Eb_N0(j);
j=j+1;
end
for k=1:19
% Invoking Function 6.3
dist_PAM(i,k) = cp0602_max_distance(Gt, Gr, f,...
PSD,Margin, 1/Rb(k), N0, Eb_N0_PAM);
% Invoking Function 6.3
dist_PPM(i,k) = cp0602_max_distance(Gt, Gr, f,...
PSD, Margin, 1/Rb(k), N0, Eb_N0_PPM);
end
end
% ---------------------------
% Step Two - Graphical output
% ---------------------------
% Building a single matrix for all vectors
M_ary_Distance = [dist_PAM' dist_PPM']'
F=figure(2);
set(gcf,'DefaultAxesColorOrder',[0 0 0],...
'DefaultAxesLineStyleOrder','-+|-o|-*|:s|:d|:^');
PT = plot(Rb/1e6,M_ary_Distance);
AX=gca;
set(AX,'FontSize',12);
X=xlabel('Data Rate [Mb/s]');
set(X,'FontSize',14);
Y=ylabel('Distance [m]');
set(Y,'FontSize',14);
axis([20 200 0 25]);
L= legend('2-PAM','4-PAM','8-PAM','2-PPM','4-PPM','8-PPM');
set(L,'FontSize',12);
text(100,15,'Pr_e = 10^{-3}','BackgroundColor',...
[1 1 1],'FontSize',12);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -