Computer Lab 10: Lecture 29

In our computer lab lectures we will work together through concepts and challanges we have discussed over the week in class.  As with your after-class Exercises, you will be expected to turn in your computer lab notebooks before the nect lecture. Please do so by e-mailing your completed *nb file to Lan Yu (ece329.uiuc@gmail.com), make sure you name the file using the following notation: “Exn_Last_First.nb”, where n is the Lecture number (in this case, 29), and First and Last would be your first and last name.  So my submission to Lan for this computer lab would be titled “Ex29_Wasserman_Dan.nb”.  You will receive full credit for your copmputer lab if it turned in before the next lecture (Lecture n+1).  No late submissions will be accepted.

Objective/Overview:

In class and our exercises this week, we were introduced to the concept of a bounce diagram: a plot that shows us the trajectory of an impulse on a transmission line, as it is launched over the source resistor, travels along the line, and then is reflected from the load resistor back towards the source resistor.  Using Mathematica, we showed how easy it was to plot these bounce diagrams in our previous exercise.  Today, we are going to take it one step further and animate our impulses as they move along the line, which gives us a pretty nice picture of what is actually happening in such a system.  After that, we are going to look at how we can use our understanding of the bounce diagram to plot arbitrary waveform propagation on these transmission lines.

Single-Bounce Impulse Response

Let’s start by just looking at a single impulse traveling along our transmission line.  We will assume the impulse is launched at t=0s.  Let’s also remember that Mathematica isn’t really good a plotting delta functions, so we will represent our delta function as an arrow whose length is the amplitude of the pulse.
We need to write the expression for our initial forward propagating impulse and then the reflected impulse:

vimpulse[zo_,rG_,rL_,tlL_]:=(tauG1=zo/(zo+rG);v=300; (*we'll plot in units of μs, which makes our velocity 300m/μs*)
gamL1=(rL-zo)/(rL+zo);gamG1=(rG-zo)/(rG+zo);vfimp1=Graphics[{Red,Arrowheads[0.1],Arrow[{{v*t,0},{v*t,tauG1}}]}];
vrimp1=Graphics[{Red,Arrowheads[0.1],Arrow[{{2*tlL-v*t,0},{2*tlL-v*t,gamL1*tauG1}}]}];
zaxis=Graphics[Line[{{0,0},{tlL,0}}]];
yaxis=Graphics[Line[{{0,0},{0,1}}]];
Animate[Show[ yaxis,zaxis,vfimp1,vrimp1,PlotRange->{{0,tlL},{-1,1}},AspectRatio->1]/.{t->to},{to,0,2*tlL/v}])

vimpulse[50,25,150,300]

Cool!!!  Let’s add current...bear in mind that the current will be a factor of Zo smaller than the voltage, so it might be harder to see...Remember, to get current we have to scale our v(z,t) by zo and also flip the sign on our reflection coefficients.

vandiimpulse[zo_,rG_,rL_,tlL_]:=(tauG1=zo/(zo+rG);v=300; (*we'll plot in units of μs, which makes our velocity 300m/μs*)
gamL1=(rL-zo)/(rL+zo);gamG1=(rG-zo)/(rG+zo);vfimp1=Graphics[{Red,Arrow[{{v*t,0},{v*t,tauG1}}]}];
ifimp1=Graphics[{Blue,Arrow[{{v*t,0},{v*t,tauG1/zo}}]}];
vrimp1=Graphics[{Red,Arrow[{{2*tlL-v*t,0},{2*tlL-v*t,gamL1*tauG1}}]}];
irimp1=Graphics[{Blue,Arrow[{{2*tlL-v*t,0},{2*tlL-v*t,-gamL1*tauG1/zo}}]}];
zaxis=Graphics[Line[{{0,0},{tlL,0}}]];
yaxis=Graphics[Line[{{0,0},{0,1}}]];
Animate[Show[ yaxis,zaxis,vfimp1,vrimp1,ifimp1,irimp1,PlotRange->{{0,tlL},{-1,1}},AspectRatio->1]/.{t->to},{to,0,2*tlL/v}])

vandiimpulse[50,25,10,300]

Look at what happens when you have perfect impedance matching (Zo=RL).  What about when you have an open circuit load?  A shorted load?
Of course, the above is just one bounce.  But we have the expression for multiple bounces in our class notes.  Below, let’s modify the expression from your class notes to model the impulse response of a TL for up to n bounces, where “n” is an input to your function that lets the user choose how many bounces s/he wants to model.  I played around with this for a while, and it turns out that what you want to do is make a Table for each of the forward and reverse voltage and current Graphics.  So your vf would be:
vf1=Table[Graphics[{Red,Arrow[{{v*t-i*2*tlL,0},{v*t-i*2*tlL,tauG1*(gamG1*gamL1)^i}}]}],{i,0,n}];

vandiimpulsen[zo_,rG_,rL_,tlL_,n_]:=(tauG1=zo/(zo+rG);v=300; (*we'll plot in units of μs, which makes our velocity 300m/μs*)
gamL1=(rL-zo)/(rL+zo);gamG1=(rG-zo)/(rG+zo);vfimpn=Table[Graphics[{Red,Arrow[{{v*t-i*2*tlL,0},{v*t-i*2*tlL,tauG1*(gamG1*gamL1)^i}}]}],{i,0,n}];
ifimpn=Table[Graphics[{Blue,Arrow[{{v*t-i*2*tlL,0},{v*t-i*2*tlL,tauG1*(gamG1*gamL1)^i/zo}}]}],{i,0,n}];
vrimpn=Table[Graphics[{Red,Arrow[{{2*tlL*(1+i)-v*t,0},{2*tlL*(1+i)-v*t,gamL1*tauG1*(gamG1*gamL1)^i}}]}],{i,0,n}];
irimpn=Table[Graphics[{Blue,Arrow[{{2*tlL*(1+i)-v*t,0},{2*tlL*(1+i)-v*t,-gamL1*tauG1*(gamG1*gamL1)^i/zo}}]}],{i,0,n}];
zaxis=Graphics[Line[{{0,0},{tlL,0}}]];
yaxis=Graphics[Line[{{0,0},{0,1}}]];
Animate[Show[ yaxis,zaxis,vfimpn,vrimpn,ifimpn,irimpn,PlotRange->{{0,tlL},{-1,1}},AspectRatio->1]/.{t->to},{to,0,(n+1)*2*tlL/v},AnimationRepetitions->1, AnimationRate->.5])

vandiimpulsen[50,25,55,300,2]

Arbitrary Waveforms

The impulse response approach is so powerful because we can use it as a framework to understand the response of our TL system to an arbitrary voltage source f(t).  We know we can write the impulse response of the transmission line shown below as:


V(z,t)=(Subscript[τ, g])(∑_(n=0)^∞)((((Subscript[Γ, g])(Subscript[Γ, L])))^n)δ(t-z/v-n2l/v)+ (Subscript[τ, g])(Subscript[Γ, L])(∑_(n=0)^∞)((((Subscript[Γ, g])(Subscript[Γ, L])))^n)δ(t+z/v-n2l/v)
This is the response of our system to a voltage of f(t)=δ(t).  If we replace our δ(t) with an arbitrary f(t), then our voltage on the TL becomes:
V(z,t)=(Subscript[τ, g])(∑_(n=0)^∞)((((Subscript[Γ, g])(Subscript[Γ, L])))^n)f(t-z/v-n2l/v)+ (Subscript[τ, g])(Subscript[Γ, L])(∑_(n=0)^∞)((((Subscript[Γ, g])(Subscript[Γ, L])))^n)f(t+z/v-n2l/v).
So the question becomes, how do we plot/animate this?  
In some ways, it become easier, since we no longer have to wory about plotting the delta function (which Methematica has trouble with).
Let’s start by trying to analyze the system below, where our f(t) is just the heaviside step function, equivalent to a switch being closed at time t=0.


Let’s try to plot this, looking only at a single bounce. For this system, let’s allow (Subscript[V, o]), (Subscript[μ, r]) and (Subscript[ϵ, r]) as inputs.

Clear[vstep]

vstep1[vo_,mur_,epsr_,zo_,rG_,rL_,tlL_]:=(muo=1.2566*10^-6;epso=8.85*10^-12;mu=mur*muo;eps=epsr*epso;v=Sqrt[1/(mu*eps)]/10^6;tauG1=zo/(zo+rG);
gamL1=(rL-zo)/(rL+zo);gamG1=(rG-zo)/(rG+zo);
vstep1p=vo*tauG1*((1-HeavisideTheta[z-v*t])+gamL1*HeavisideTheta[z-2*tlL+v*t]);
Animate[Plot[vstep1p/.{t->to},{z,0,tlL}, PlotRange->{0,2*vo}],{to,0,2*tlL/v},AnimationRepetitions->1, AnimationRate->.5])

vstep1[1,1,1,50,25,200,300]

We can then add the additional bounces

vstep2[vo_,mur_,epsr_,zo_,rG_,rL_,tlL_,n_]:=(muo=1.2566*10^-6;epso=8.85*10^-12;mu=mur*muo;eps=epsr*epso;v=Sqrt[1/(mu*eps)]/10^6;tauG1=zo/(zo+rG);
gamL1=(rL-zo)/(rL+zo);gamG1=(rG-zo)/(rG+zo);
vstep2p=Sum[vo*tauG1*((gamL1*gamG1)^i*(1-HeavisideTheta[z-v*t+i*tlL*2])+gamL1*(gamL1*gamG1)^i*HeavisideTheta[z-2*tlL*(i+1)+v*t]),{i,0,n}];
Animate[Plot[vstep2p/.{t->to},{z,0,tlL}, PlotRange->{0,2*vo}],{to,0,n*2*tlL/v},AnimationRepetitions->1, AnimationRate->.5])

vstep2[1,1,1,50,100,100,300,2]

So this works pretty nicely!  If you let n>3, you will see that the voltage on your line basically approaches a constant number.  For a given choice of (Subscript[Z, o]), (Subscript[R, L]), and (Subscript[R, g]), determine this voltage.  Then see if you can figure out how to predict what this voltage will be for any (Subscript[Z, o]), (Subscript[R, L]), and (Subscript[R, g]).  Test your guess with a different set of (Subscript[Z, o]), (Subscript[R, L]), and (Subscript[R, g])’s.
By this point, you may have entered numbers for (Subscript[Z, o]), (Subscript[R, L]), and (Subscript[R, g]) that give you impedance matching at either the source or load resistor.  You probably noticed that Mathematica doesn’t like this, because you are asking Mathematica to calculate 0^0, which is undetermined.  We can fix this pretty easily, though...

vstep3[vo_,mur_,epsr_,zo_,rG_,rL_,tlL_,n_]:=(muo=1.2566*10^-6;epso=8.85*10^-12;mu=mur*muo;eps=epsr*epso;v=Sqrt[1/(mu*eps)]/10^6;tauG1=zo/(zo+rG);
gamL1=(rL-zo)/(rL+zo);gamG1=(rG-zo)/(rG+zo);
vstep3p=Sum[If[i==0,vo*tauG1*(1-HeavisideTheta[z-v*t+i*tlL*2])+gamL1*HeavisideTheta[z-2*tlL*(i+1)+v*t],vo*tauG1*((gamL1*gamG1)^i*(1-HeavisideTheta[z-v*t+i*tlL*2])+gamL1*(gamL1*gamG1)^i*HeavisideTheta[z-2*tlL*(i+1)+v*t])],{i,0,n}];
Animate[Plot[vstep3p/.{t->to},{z,0,tlL}, PlotRange->{0,2*vo}],{to,0,n*2*tlL/v},AnimationRepetitions->1, AnimationRate->.5])

vstep3[1,1,1,100,100,100,300,2]

Now it’s your turn!  Write a similar expression that animates the current vs. z on the TL for all of the inputs we used above:

istep3[vo_,mur_,epsr_,zo_,rG_,rL_,tlL_,n_]:=(muo=1.2566*10^-6;epso=8.85*10^-12;mu=mur*muo;eps=epsr*epso;v=Sqrt[1/(mu*eps)]/10^6;tauG1=zo/(zo+rG);
gamL1=(rL-zo)/(rL+zo);gamG1=(rG-zo)/(rG+zo);
istep3p=;
Animate[Plot[istep3p/.{t->to},{z,0,tlL}, PlotRange->{0,2*vo/zo}],{to,0,n*2*tlL/v},AnimationRepetitions->1, AnimationRate->.5])

That wasn’t so bad.  Can you revise the code we developed above to plot the propagation of a d’Alembert wavefunction on a TL?  Pick one that you want to use, either a rect, Δ, sawtooth, whatever you like, and plot the propagation of the voltage signal on a TL for the inputs we used above.

istep3[1,1,1,50,100,0,300,4]