Pathloss effect MATLAB code
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.