The wave equation for the voltage on a lossless transmission line that we discussed in class is
$$\frac{\partial^2 v}{\partial z^2} = \frac{1}{u^2}\frac{\partial^2 v}{\partial t^2}.$$It has a general solution of the form
$$v(z,t) = v^+(z - ut) + v^-(z + ut),$$where $z$ is position along the transmission line, $t$ is time, and $u$ is the phase velocity. $v^+$ and $v^-$ represent forward and reverse propagating waves, respectively (i.e., in the $+z$ and $-z$ directions). We'll use the following code to illustrate this.
In [1]:
# Import needed modules
from IPython.html.widgets import interact, fixed
import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline
In [2]:
# Define a simple arbitrary pulse function. Let's use 1/2 cycle of a cosine centered at 0,
# and zero everywhere else.
def pulse(a):
if a < np.pi/2.0 and a > -np.pi/2.0:
return np.cos(a)
else:
return 0.0
In [3]:
# Create a function to plot a forward propagating pulse. Use interact() to make it interactive.
zmin = -30
zmax = 30
numpnts = 500
def plotpulse(u,t):
x = np.linspace(zmin,zmax,numpnts)
y = np.zeros(numpnts)
for i in range(0,numpnts):
y[i] = pulse(x[i] - u*t)
plt.plot(x,y)
plt.ylim(0,1.2)
plt.xlabel('z')
plt.figtext(0.15,0.82,'t = ' + str(t))
interact(plotpulse, u=fixed(1.0), t=(-30,30,0.25));
In [4]:
# Create a function to plot both forward and backward propagating pulses,
# arbitrarily starting them at z=0.
zmin = -30
zmax = 30
numpnts = 500
def plotpulses(u,t):
x = np.linspace(zmin,zmax,numpnts)
yforward = np.zeros(numpnts)
ybackward = np.zeros(numpnts)
for i in range(0,numpnts):
yforward[i] = pulse(x[i] - u*t)
ybackward[i] = pulse(x[i] + u*t)
plt.plot(x,yforward, 'b')
plt.plot(x,ybackward, 'r')
plt.ylim(0,1.2)
plt.xlabel('z')
plt.figtext(0.15,0.82,'t = ' + str(t))
interact(plotpulses, u=fixed(1.0), t=(-30,30,0.25));
In [5]:
plt.get_backend()
Out[5]:
In [ ]: