This is probably a very simple case but I am not sure where I am going wrong. In order to estimate the effect of path loss in Matlab, the function fspl(R,lambda) gives a pathloss value for a distance Rin $dB$.

My question is that, for using this function should one directly multiply the path loss value in $dB$ or convert it to linear scale and then multiply. If I use the $dB$ value, the signal power increases and if I use the linear scale value, there is a lot of difference between the transmitted and received power. Here's a snippet of my code:

SNR =2;    
Fc = 2.4e9;
d = 5; lambda = physconst('LightSpeed')/Fc;    
data=randi([0 1],3000,1);
hMod = comm.OQPSKModulator('BitInput',true);
modulated_sgl = step(hMod, data);
pathloss_dB = fspl(d,lambda);
tx_sgl = modulated_sgl * pathloss_dB ;

If I try to plot the power spectral density of tx_sgl and modulated_sgl using the following:

hss = dsp.SpectrumAnalyzer('SampleRate', Fs); 
step(hss,[tx_sgl modulated_sgl]);

I observe however that the power of tx_sgl is higher than the modulated_sgl. Can someone guide me where I may be going wrong.


The function gives you the path loss in dB. This number is positive, i.e. a path loss of $3$ dB corresponds to a gain of $-3$ dB. So for a given path loss $x$ (in dB), the signal is attenuated by a factor $10^{-x/20}$. Note that multiplication with a dB value hardly ever makes any sense.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.