Rational InterpolationΒΆ

Should be a better interpolation method that causes less errors with time-domain transformations.

Based on: https://www.in.tu-clausthal.de/fileadmin/homes/techreports/ifi0606floater.pdf

Example:

[1]:
import skrf
import matplotlib.pyplot as plt
from skrf.plotting import stylely

%matplotlib inline
stylely()

freq = skrf.F(0.5,110,801)
freq2 = skrf.F(0,110,801)
coax1mm = skrf.media.Coaxial(freq, z0=50, Dint=0.44e-3, Dout=1.0e-3, sigma=1e20)
coax1mm2 = skrf.media.Coaxial(freq2, z0=50, Dint=0.44e-3, Dout=1.0e-3, sigma=1e20)

X = coax1mm.line(10, 'mm', z0=50, name='X', embed=True)
Y = coax1mm.line(80, 'mm', z0=75, name='Y', embed=True)
dut = X**Y**X

X2 = coax1mm2.line(10, 'mm', z0=50, name='X', embed=True)
Y2 = coax1mm2.line(80, 'mm', z0=75, name='Y', embed=True)
dut2 = X2**Y2**X2
dut2.name = 'real'

dut_dc_rational = dut.extrapolate_to_dc(kind='rational', dc_sparam=[[0,1],[1,0]])
dut_dc_rational.name = 'rationnal'
dut_dc_linear = dut.extrapolate_to_dc(kind='linear', dc_sparam=[[0,1],[1,0]])
dut_dc_linear.name = 'linear'
dut_dc_cubic = dut.extrapolate_to_dc(kind='cubic', dc_sparam=[[0,1],[1,0]])
dut_dc_cubic.name = 'cubic'

plt.figure()
plt.title('Step Response Lowpass')
dut2.s11.plot_s_time_step(pad=2000, window='hamming')
dut_dc_rational.s11.plot_s_time_step(pad=2000, window='hamming')
dut_dc_linear.s11.plot_s_time_step(pad=2000, window='hamming')
dut_dc_cubic.s11.plot_s_time_step(pad=2000, window='hamming')

plt.figure()
plt.title('Impulse Response Lowpass')
dut2.s11.plot_s_time_impulse(pad=2000, window='hamming')
dut_dc_rational.s11.plot_s_time_impulse(pad=2000, window='hamming')
dut_dc_linear.s11.plot_s_time_impulse(pad=2000, window='hamming')
dut_dc_cubic.s11.plot_s_time_impulse(pad=2000, window='hamming')

plt.figure()
plt.title('Impulse Response Bandpass')
dut2.s11.plot_s_time(pad=2000, window='hamming')
(dut_dc_rational.s11.windowed()).plot_s_time()
(dut_dc_linear.s11.windowed()).plot_s_time()
(dut_dc_cubic.s11.windowed()).plot_s_time()

plt.show(block=True)
/home/docs/checkouts/readthedocs.org/user_builds/scikit-rf/conda/latest/lib/python3.5/site-packages/matplotlib/style/core.py:51: UserWarning: Style includes a parameter, 'interactive', that is not related to style.  Ignoring
  "to style.  Ignoring".format(key))
/home/docs/checkouts/readthedocs.org/user_builds/scikit-rf/conda/latest/lib/python3.5/site-packages/scikit_rf-0.14.8-py3.5.egg/skrf/tlineFunctions.py:144: RuntimeWarning: divide by zero encountered in true_divide
  return sqrt(rho/(pi*f*mu_r*mu_0))
/home/docs/checkouts/readthedocs.org/user_builds/scikit-rf/conda/latest/lib/python3.5/site-packages/numpy/core/numeric.py:501: ComplexWarning: Casting complex values to real discards the imaginary part
  return array(a, dtype, copy=False, order=order)
../../_images/examples_networktheory_Rational_Interpolation_2_1.png
../../_images/examples_networktheory_Rational_Interpolation_2_2.png
../../_images/examples_networktheory_Rational_Interpolation_2_3.png
[2]: