Hello. ı want to plot a correlation between the received power (Pr(dB)) and the frequency (f)(variable of an anonymous function PL_dB). my equation is Pr_dB = @(f) TXPower - PL_dB(f);
where Pr_dB is the received power,
TXPower the transmitted power. TXPower is a parameter that can be enter from the GUI,
PL_dB the path loss. it is function of the frequency f.
the problem with the code is that the Pr(dB) gives me wrongs answers.
Pr_dB =30 -102= -72 but the code gives me 41 as Pr_dB value. Can someone please help me with that? here below is the code.
c = 3e8;
h_BS = 15;
lambda = @(f) (c/(f*1e9));
PL_dB =@(f)( 20*log(4*pi*d0*f*1e9/c) + 30.7*(1-0.049*((h_BS-35)/35))*log((TRDistance)) + SF*randn);
Pr_dB =@(f) TXPower - PL_dB(f);
fprintf('the path loss is %d , the received power is %d .\n ',func2str(PL_dB) ,func2str(Pr_dB));
fprintf('the TX is %d .\n',(TXPower));