# Interactive Mismatched Line¶

## Intro¶

This is a demonstration of using IPythons interact function with some of skrf’s network creation methods.

As of IPython 2.0, the widgets in this notebook won’t show up on http://nbviewer.ipython.org. To view the widgets and interact with them, you will need to download this notebook and run it with an IPython Notebook server.

:

from IPython.display import YouTubeVideo
YouTubeVideo('JyYi_1SswXs',width=700, height=580)


:

:

from ipywidgets import interact
%matplotlib inline
from pylab import *

from skrf.media import DistributedCircuit
from skrf import Frequency
import skrf as rf
rf.stylely()

# define a frequency object
freq = Frequency(0,10,1001,'ghz')

# create a Media object for RG-58, based on distributed ckt values
rg58 = DistributedCircuit(frequency = freq,
C =93.5e-12,#F/m
L =273e-9,  #H/m
R =0,#53e-3,   #Ohm/m
G =0,       #S/m
)

/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))


## Mismatched Line¶

This demonstrates the response of a mismatched transmission line of a given length. Specifically, a line of electrical length $$d$$ with characteristic impedance $$z_0$$ is embedded in the coaxial environment (RG-58 ) with $$z_0 \approx 54\Omega$$. The resultant S-parameters are plotted in log mag and on the smith chart.

### Log Mag¶

:

def func(d=180,z0=54):
ntwk =rg58.line(d=d,unit='deg',z0=z0, embed=True)
ntwk.plot_s_db(1,0)
ntwk.plot_s_db(0,0)
ylim(-50,20)
draw();show()

interact(func, d= (0,360,10),z0=(10,200,1),embed=True);

/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/media/distributedCircuit.py:211: RuntimeWarning: invalid value encountered in true_divide
return sqrt(self.Z/self.Y) ### Smith Chart¶

:


def func(d=180,z0=54):
ntwk =rg58.line(d=d,unit='deg',z0=z0, embed=True)
ntwk.plot_s_smith(1,0)
ntwk.plot_s_smith(0,0)
draw();show()

interact(func, d= (0,180,10),z0=(10,200,1),embed=True); :