Exercise 18

As with all of the exercises you will complete in this course, you will be expected to turn your *.nb file in to the course TA before the next lecture.  Please do so by e-mailing your completed exercise 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 Exercise number (in this case, 18), and First and Last would be your first and last name.  So my submission to Lan for this exercise would be titled “Ex18_Wasserman_Dan.nb”.  You will receive full credit for your exercise if it turned in before the next lecture (Lecture n+1).  No late submissions will be accepted.

Objective/Overview:

In today’s Lecture (18) we were re-introduced to the wave equation.  We saw that we can combine Maxwell’s Equations to find expressions for the Electric and Magnetic fields as functions of both position and time.   Sometimes it can be tricky to visualize wave propagation, so in this exercise, we are going to focus on understanding what these waves actually look like.

ClearAll[wavef1,waveb1]

Harmonic Waves

We are going to spend a lot more time with harmonic waves in a few lectures, but our starting point for understand the solutions of Maxwell’s Wave Equation were the harmonic solutions: (OverVector[E])∝cos(ωt±βz))∝cos(ω(t±(z/v))).  These waves have a single frequency (ω), and we showed that they are solutions to the wave equation by comparing the second derivatives with respect to time and position.  Let’s try to plot these waves, starting with, as our example,  (OverVector[E])(z)=cos(ω(t∓(z/v)))(OverHat[x])  
We first should note that these are “plane wave” solutions, and as such, they have no dependence on x and y.  In other words, your (OverHat[x])-polarized E field extends infinitely in the x and y directions. 
This solution to the wave equation is basically a time-varying vector field, so let’s see if we can plot that...and let’s work only in the xz plane, since nothing changes in the y-direction.

wavef1[w_,v_,t_]:={Cos[w*(t-(z/v))],0}

Animate[VectorPlot[wavef1[1,1,t],{x,-1,1},{z,-1,1}],{t,0,10}]

This is pretty cool!  We see the evolution of the vector field in position and time.  What happens if we flip the sign in our Cos expression?

waveb1[w_,v_,t_]:={Cos[w*(t+(z/v))],0}

Animate[VectorPlot[waveb1[1,1,t],{x,-1,1},{z,-1,1}],{t,0,10}]

Our wave is now clearly moving in the -(OverHat[z]) direction!  
Of course, plotting a 2D vector field is fairly useless, since the field is constant along the x-direction.  So generally, we can plot just the amplitude of the field as a function of z.  Let’s try that:

wavef2[w_,v_,t_]:=Cos[w*(t-z/v)]

Animate[Plot[wavef2[1,1,t],{z,0,10}, PlotRange->{-1,1}], {t,0,20}]

Try changing ω, holding all else constant.  What happens to the spacing between the peaks of your wave (your wavelength)?  What happens to the spacing (wavelength) if you hold ω constant and change velocity?  As a note, if you Right-click on the plot and select “Get Coordinates”, you can read off values from your plot...
Try each of these, noting ω, v, and λ (wavelength).  Give the relationship between the three?

Superposition of Waves

We learned early in the course that we can add the electric fields from different charge distributions to get the total electric field from a more complicated charge distribution.  So we should be able to do the same with electric fields.  Let’s try this with our waves above.
First, let’s plot two waves of the same velocity, but very different frequencies

Animate[Plot[wavef2[1,1,t]+wavef2[10,1,t],{z,0,10}, PlotRange->{-2,2}], {t,0,20}]

Note that we can adjust the amplitudes of the waves by just multiplying them by a scalar.

Animate[Plot[wavef2[1,1,t]+0.1*wavef2[20,1,t],{z,0,10}, PlotRange->{-2,2}], {t,0,20}]

Now, as an aside, try adding the two waves that are exactly the same, but have velocituies of opposite sign.  What do you see?

What you have created here is called a “Standing Wave”.  We will see a lot more of these in coming weeks....
As you can see, we can add together multiple waves, traveling at the same velocity, but with very different frequencies.  If we add enough waves together, with enough different frequencies, we can create waveforms with arbitrary shapes, we call these, the d’Alembert waveforms.

D’Alembert Waveforms

As we discussed in class, these waveforms can be unit steps, triangular, rectangular, etc.  Mathematica has packages of waveforms, but they are in the “Audio” package, so we can build ours ourselves.
Let’s build a rectangular waveform

rect[to_,t_]:=UnitStep[t+to/2]-UnitStep[t-to/2]

Plot[rect[2,t], {t,-5,5}]

To see the actual wave propagating, we need to add our velocity and z terms.

rectwave[to_,t_,v_]:=rect[to,t-z/v]

Animate[Plot[rectwave[2,t,1],{z,-5,20}],{t,0,10}]

Cool!! We can clearly see our waveform moving along with a velocity v.  We can also use this expression to plot the amplitude at some point z=zo as a function of time...How?

Plot[rectwave[2,t,1]/.{z->10}, {t,0,15}]

You can see that it takes the leading edge of the rectwave 9 seconds to get to point z=10, and then 2 seconds for the wave to pass by z=10 entirely.  This makes sense, because the wave is 2s long in time, so it should take 2seconds for the wave to pass through z=10.  Alternatively, you can think of the wave as being 2m wide in space, travelling at a speed of 1m/s, so you would expect it would take 2s for the wave to pass by the position z=10m.
Now use what you have learned to plot a triangular d’Alembert wave.  Animate the wave propagation and then plot the amplitude of the wave at some point in space (let’s say z=-4) as a function of time...

tri[to_,t_]:=

Plot[tri[2,t],{t,-5,5}, PlotRange->Full]

triwave[to_,t_,v_]:=

Animate[Plot[triwave[2,t,1],{z,-5,20}],{t,0,10}]

Plot[triwave[2,t,1]/.{z->-4}, {t,-10,10}]