# 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

:

:

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
)


## 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);


### 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);

[ ]: