# skrf.network.Network.gain_circle

Network.gain_circle(target_port, gain, npoints=181)[source]

Returns loci of gain circles for a given port (0 or 1) and a specified gain. The network must have two ports. The center and radius of the source (here target_port=0) gain circle are calculated by the following equations [1] [2].

\begin{align}\begin{aligned}C_{S} = \frac{g_{S}S_{11}^*}{1 - (1 - g_{S})|S_{11}|^{2}}\\R_{S} = |\frac{\sqrt{(1 - g_{S})}(1 - |S_{11}|^{2})}{1 - (1 - g_{S})|S_{11}|^{2}}\end{aligned}\end{align}

where $$g_{S}$$ is obtained by normalizing the specified gain by the maximum gain of the source matching network $$G_{Smax}$$

$g_{S} = \frac{gain}{G_{Smax}} = gain * (1 - |S_{11}|^{2})$

Similarly, those of the load side (here target_port=1) are calculated by the following equations.

\begin{align}\begin{aligned}C_{L} = \frac{g_{L}S_{22}^*}{1 - (1 - g_{L})|S_{22}|^{2}}\\R_{L} = |\frac{\sqrt{(1 - g_{L})}(1 - |S_{22}|^{2})}{1 - (1 - g_{L})|S_{22}|^{2}}\\with\\g_{L} = \frac{gain}{G_{Lmax}} = gain * (1 - |S_{22}|^{2})\end{aligned}\end{align}
Parameters:
• target_port (int) – Specifies the port number (0 or 1) to calculate gain circles.

• gain (float) – Gain of source or load matching network in decibels.

• npoints (int, optional) – The number of points on the circumference of the circle. More points result in a smoother circle, but require more computation. Default is 181.

Returns:

gc – Loci of gain circles in complex numbers

Return type:

numpy.ndarray (shape is npoints x f)

Example

>>> import skrf as rf
>>> import matplotlib.pyplot as plt


Create a two-port network object

>>> ntwk = rf.Network('fet.s2p')


Calculate the source gain circles for all the frequencies at a gain of 2 dB

>>> sgc = ntwk.gain_circle(target_port=0, gain=2.0)


Plot the circles on the smith chart

>>> rf.plotting.plot_smith(s=sgc, smith_r=1, marker='o')
>>> plt.show()


Slicing the network allows you to specify a frequency

>>> sgc = ntwk['1GHz'].gain_circle(target_port=0, gain=2.0)
>>> rf.plotting.plot_smith(s=sgc, smith_r=1, marker='o')
>>> plt.show()


References

max_gain
max_stable_gain
unilateral_gain