# Rational InterpolationΒΆ

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

Example:

[1]:

%matplotlib inline

[2]:

import skrf
import matplotlib.pyplot as plt
from skrf.plotting import stylely
from skrf.media import Coaxial
stylely()

[3]:

freq = skrf.F(0.5,110,801)
freq2 = skrf.F(0,110,801)
coax1mm = Coaxial(freq, z0=50, Dint=0.44e-3, Dout=1.0e-3, sigma=1e20)
coax1mm2 = 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 = 'rational'
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'

/home/docs/checkouts/readthedocs.org/user_builds/scikit-rf-jhillairet/envs/latest/lib/python3.8/site-packages/skrf/tlineFunctions.py:160: RuntimeWarning: divide by zero encountered in true_divide
return sqrt(rho/(pi*f*mu_r*mu_0))

[4]:

plt.figure()
plt.title('Step Response Lowpass')

[5]:

plt.figure()
plt.title('Impulse Response Lowpass')

[6]:

plt.figure()
plt.title('Impulse Response Bandpass')
(dut_dc_rational.s11.windowed()).plot_s_time()
(dut_dc_linear.s11.windowed()).plot_s_time()
(dut_dc_cubic.s11.windowed()).plot_s_time()

/home/docs/checkouts/readthedocs.org/user_builds/scikit-rf-jhillairet/envs/latest/lib/python3.8/site-packages/matplotlib/cbook/__init__.py:1333: ComplexWarning: Casting complex values to real discards the imaginary part
return np.asarray(x, float)

[ ]: