Ex2: Measured 190 GHz Active 2-Port

The Vector Fitting feature is demonstrated using a 2-port S-matrix of an active circuit measured from 140 GHz to 220 GHz. Additional explanations and background information can be found in the Vector Fitting tutorial.

import skrf
import numpy as np
import matplotlib.pyplot as mplt

This example is a lot more tricky to fit, because the responses contain a few “bumps” and noise from the measurement. In such a case, finding a good number of initial poles can take a few iterations. A good alternative for such cases is the automatic vector fitting feature, auto_fit(), which automatically refines the number of poles until a good fit is achieved.

Load the Network from a Touchstone file and create the Vector Fitting instance and start the automatic fit:

nw = skrf.network.Network('./190ghz_tx_measured.S2P')
vf = skrf.VectorFitting(nw)

The function plot_convergence() can be helpful to examine the convergence and see if something was going wrong. Important parameters to check are the number of iterations until convergence and the final model order.

print(f'model order = {vf.get_model_order(vf.poles)}')
print(f'n_poles_real = {np.sum(vf.poles.imag == 0.0)}')
print(f'n_poles_complex = {np.sum(vf.poles.imag > 0.0)}')
model order = 15
n_poles_real = 1
n_poles_complex = 7

Checking the results by comparing the model responses to the original sampled data indicates a successful fit, which is also indicated by a small rms error (less than 0.05):

# plot frequency responses

It is a good idea to also check the model response well outside the original frequency range.

freqs = np.linspace(0, 500e9, 501) # plot model response from dc to 500 GHz