Pathloss effect MATLAB code I want to implement the pathloss effect using MATLAB simulation. 
I use the D2D path loss model: 
$$148+40\log_{10}(d)$$
I did not find the right way to add the pathloss effect in the received signal, which is a vector of QAM randomly chosen elements.
A propagation loss expressed in decibels is equivalent to an attenuation in linear scale. If you have a loss of l_dB (in dB), that's equivalent to an attenuation of l = 10^(l_dB/20). So, if your transmitted signal is S, the received signal is R = S ./ l.

Note that the factor of 1/20 in the conversion from dB to linear scale is needed because we're scaling the amplitude (voltage) of the signal.