# Path Loss Models

This notebook illustrates some path loss models.

## Initializations

First we set the Python path and import some libraries.

``````

In [1]:

%matplotlib inline

import numpy as np
from matplotlib import pyplot as plt

``````

Now we import some pyphysim stuff

``````

In [2]:

from pyphysim.channels import pathloss

``````

## Path Loss Classes Representation in IPython

``````

In [3]:

pl_general = pathloss.PathLossGeneral(n=3.7, C=120)
pl_general.handle_small_distances_bool = True
pl_general

``````
``````

Out[3]:

PathLossGeneral (n=3.7, C=120): \$PL = 37.0 \log_{10} (d) + 120\$

``````
``````

In [4]:

pl_3gpp = pathloss.PathLoss3GPP1()
pl_3gpp.handle_small_distances_bool = True
pl_3gpp

``````
``````

Out[4]:

PathLoss3GPP1: \$PL = 37.599999999999994 \log_{10} (d) + 128.1\$

``````
``````

In [5]:

pl_fs = pathloss.PathLossFreeSpace()
pl_fs.n = 2
pl_fs.fc = 900
pl_fs.handle_small_distances_bool = True
pl_fs

``````
``````

Out[5]:

PathLossFreeSpace (n=2, fc=900): \$PL = 20 \log_{10} (d) + 91.5266223748352\$

``````
``````

In [6]:

d = np.linspace(0.01, 0.5, 100)
fig, ax = plt.subplots()
pl_general.plot_deterministic_path_loss_in_dB(d,
ax,
extra_args={'label': 'General'})
pl_fs.plot_deterministic_path_loss_in_dB(d,
ax,
extra_args={'label': 'Free Space'})
pl_3gpp.plot_deterministic_path_loss_in_dB(d, ax, extra_args={'label': '3GPP'})
ax.grid()
ax.set_ylabel('Path Loss (in dB)')
ax.set_xlabel('Distance (in Km)')
ax.legend(loc=5)
plt.show()

``````
``````

``````