(*^
::[ Information =
"This is a Mathematica Notebook file. It contains ASCII text, and can be
transferred by email, ftp, or other text-file transfer utility. It should
be read or edited using a copy of Mathematica or MathReader. If you
received this as email, use your mail application or copy/paste to save
everything from the line containing (*^ down to the line containing ^*)
into a plain text file. On some systems you may have to give the file a
name ending with ".ma" to allow Mathematica to recognize it as a Notebook.
The line below identifies what version of Mathematica created this file,
but it can be opened using any other version as well.";
FrontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.2";
MacintoshStandardFontEncoding;
fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e8, 24, "Times";
fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e6, 18, "Times";
fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, e6, 14, "Times";
fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, a20, 18, "Times";
fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, a15, 14, "Times";
fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, a12, 12, "Times";
fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 14, "Times";
fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times";
fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L-5, 12, "Courier";
fontset = output, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier";
fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, R65535, L-5, 12, "Courier";
fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier";
fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, B65535, L-5, 12, "Courier";
fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, groupLikeGraphics, M7, l34, w293, h143, 12, "Courier";
fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, 10, "Geneva";
fontset = header, inactive, noKeepOnOnePage, preserveAspect, M7, 12, "Times";
fontset = leftheader, inactive, L2, 12, "Times";
fontset = footer, inactive, noKeepOnOnePage, preserveAspect, center, M7, 12, "Times";
fontset = leftfooter, inactive, L2, 12, "Times";
fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times";
fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times";
fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times";
fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times";
fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times";
fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times";
fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times";
fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times";
paletteColors = 128; currentKernel;
]
:[font = section; inactive; Cclosed; noKeepOnOnePage; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup]
Problem 1: RLC Tuning Circuit.
Note, this first problem is from a real-live class assignment.
Ignore the student-specific remarks, but do complete the exercise.
;[s]
2:0,0;32,1;164,-1;
2:1,19,14,Times,1,18,0,0,0;1,16,12,Times,1,14,0,0,0;
:[font = section; inactive; noKeepOnOnePage; preserveAspect; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981]
Chapter 36: Alternating Currents
:[font = subsubsection; inactive; noKeepOnOnePage; preserveAspect]
Assignment: Your assignment is in parts. I have entered all the necessary Mathematica commands you will need. All you have to do is adjust the values for r, c, and L, and plot the functions. Hand in the print out.
;[s]
3:0,0;75,1;86,0;218,-1;
2:2,13,9,Times,1,12,0,0,0;1,13,9,Times,3,12,0,0,0;
:[font = subsubsection; inactive; noKeepOnOnePage; preserveAspect]
1) First save this Notebook to your disk so you can make changes.
2) Execute the entire notebook, and look at the figures.
Now, your job as a radio engineer is to design a radio that will pick up KPLX 105.9 MHz on the FM radio band.
3) Convert MHz to radians/sec.
4) Adjust the values for c and L to make the resonant frequency equal to the above frequency. (Try to pick the values to make the curve more or less symmetric.)
5) Pick an value for r so that the current from the next station 105.7 MHz is about 1/10th of I(max). (I only want this to be approximate. Do it by trial and error, and eyeball it.)
6) Plot the current vs. frequency.
7) Plot the current vs. frequency, BUT make r three times larger than the above value.
8) Comment on the difference you get using the 2 values for r.
:[font = section; inactive; Cclosed; noKeepOnOnePage; preserveAspect; cellOutline; startGroup]
LRC Circuit
:[font = text; inactive; preserveAspect]
First, Clear the variables. Always a good idea when you get strange results.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
Clear["Global`*"];
:[font = text; inactive; preserveAspect]
Now define the effective resistances.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
xr=r;
xc=1/( w c);
xL=w L;
:[font = text; inactive; preserveAspect]
Add them together in the proper way.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
z=Sqrt[ xr^2 + (xL-xc)^2]
:[font = text; inactive; preserveAspect]
The resonant frequency is defined as:
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
resonance=1/Sqrt[ L c ]
:[font = text; inactive; preserveAspect]
Using a modified Ohm's Law, the current will be:
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
current=voltage/z
:[font = text; inactive; preserveAspect]
And the phase will be:
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
phase=ArcTan[xr,(xL-xc)]
:[font = text; inactive; preserveAspect]
Now let's pick some values to plot.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
r=50;
c=1 * 10^-6;
L=1;
voltage=1;
:[font = text; inactive; preserveAspect]
See what the resonant frequency is:
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
resonance
:[font = text; inactive; preserveAspect]
Examine the expression for the current.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
current
:[font = text; inactive; preserveAspect]
Examine the expression for the phase.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
phase
:[font = text; inactive; preserveAspect]
Now plot the current as a function of the frequency, w. Note, I plot w from zero to twice the resonant frequency value. We get a divide by zero error, but Mathematica is easy going about such problems. Call this plot p1.
;[s]
3:0,0;157,1;168,0;225,-1;
2:2,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0;
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
p1=Plot[current, {w,0, 2 resonance}]
:[font = text; inactive; preserveAspect]
Now plot the phase in units of Pi as a function of the frequency, w. Note, I plot w from zero to twice the resonant frequency value. We get a divide by zero error, but Mathematica is easy going about such problems. The phase varies from -Pi/2 to +Pi/2.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
Plot[phase/Pi, {w,0, 2 resonance}]
:[font = text; inactive; preserveAspect]
Now plot the current as a function of the frequency, w, BUT now change r to 200 ohms, and see what changes. Note, I plot w from zero to twice the resonant frequency value. Call this plot p2.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
r=200;
current=voltage/z;
p2=Plot[current, {w,0, 2 resonance}]
:[font = text; inactive; preserveAspect]
Compare plots p1 and p2. Force the PlotRange to show All points.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect; endGroup; endGroup]
Show[p1,p2, PlotRange->All]
:[font = section; inactive; Cclosed; noKeepOnOnePage; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup]
Example 2: Resonance: Poles in the complex frequency plane
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
Clear["Global`*"];
:[font = text; inactive; preserveAspect]
We can think of a resonance as a pole in the complex frequency plane.
Here, we define z= w + I g, and z0 = w0 + I g0 where we think of w as the real part of the frequency, and g (Gamma) as the width of the resonance. The pole is at z0, and we will plot the Abs in the complex frequency (z) plane.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
z = w + I g;
z0= w0 + I g0;
:[font = text; inactive; preserveAspect]
We choose some random values. I take the width to be 1/10th of the resonant frequency.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
values={w0->1, g0 -> 1/10}
:[font = text; inactive; preserveAspect]
Here is the plot of the Abs[1/(z-z0)] in the complex frequency plane.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
Plot3D[ 1/(z-z0) //.values //Abs
,{w,0,2}
,{g,-1,1}
];
:[font = text; inactive; preserveAspect]
We can examine slices along the Re axis as a function of the width g0.
To make it look fancy, I define a colorList used to color the lines.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
colorList= Table[RGBColor[Cos[theta],Sin[theta],0],{theta,0,Pi/2,(Pi/2)/10}] //N;
:[font = text; inactive; preserveAspect]
We make a table of values with g0 ranging from {0.1, 1.0}. The red curves correspond to the lower values of g0.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect; endGroup]
Plot[ Table[ 1/(z-z0) ,{g0,0.1,1.0,0.1}] /.values /.{g ->0} //Abs //Evaluate
,{w,0,2}
,PlotRange->All
,PlotStyle->colorList
,AxesOrigin->{0,0}
];
:[font = section; inactive; Cclosed; noKeepOnOnePage; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup]
Example 3: General resonance problem:
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
Clear["Global`*"];
:[font = text; inactive; preserveAspect]
To simplify matters, let's define the following for PlotStyle:
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
colorList={{RGBColor[1,0,0]}
,{RGBColor[0,1,0],Thickness[0.008]}
,{RGBColor[0,0,1],Thickness[0.008],Dashing[{0.020}]}
};
:[font = subsection; inactive; noKeepOnOnePage; preserveAspect]
Part a)
:[font = text; inactive; preserveAspect]
Let's start with the most general oscillator including a damping term (b) and a driving term (F). We'll assume an oscillatory driving force.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
(* Short cut: Don't put in the "==" yet. *)
eq1= x''[t] + 2 b x'[t] + w0^2 x[t] - F Exp[I w t]
:[font = text; inactive; preserveAspect]
Let's guess that the solution is also oscillatory.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
eq2= eq1 /.{x-> (A Exp[I w #]&)}
:[font = text; inactive; preserveAspect]
Dividing out a common factor,
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
eq3= eq2 /Exp[I w t]==0 //Simplify
:[font = text; inactive; preserveAspect]
we can solve this equation for the A coefficient as a function of frequency.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
aSol= Solve[eq3,A][[1]] //Simplify
:[font = text; inactive; preserveAspect]
This gives us a particular solution.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
xPart[t_] = ( A Exp[I w t] /.aSol )
:[font = subsection; inactive; noKeepOnOnePage; preserveAspect]
Part b)
:[font = text; inactive; preserveAspect]
Choosing some values,
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
Atmp1= A /.aSol //.{F->1, b -> w0/5, w0->2}
:[font = text; inactive; preserveAspect]
we can plot the {Abs, Re, Im} parts of this amplitude.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
Plot[ {Atmp1 //Abs, Atmp1 //Re, Atmp1 //Im}
,{w,0,6}
,PlotStyle->colorList
,PlotRange->All
];
:[font = text; inactive; preserveAspect]
Here is a plot of the phase in units of Pi. Note that this goes through a phase shift of Pi.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
Plot[ (-1/Pi) ArcTan[Re[Atmp2],Im[Atmp2]]
,{w,0,6}
];
:[font = text; inactive; preserveAspect]
Let's compare the phase shifts:
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
Plot[{(-1/Pi) ArcTan[Re[Atmp1],Im[Atmp1]]
,(-1/Pi) ArcTan[Re[Atmp2],Im[Atmp2]]
}
,{w,0,6}
,PlotStyle->colorList
,PlotRange->All
];
:[font = subsection; inactive; noKeepOnOnePage; preserveAspect]
Part d)
:[font = text; inactive; preserveAspect]
We now obtain the general solution.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
genSol = DSolve[ (eq1 /.{F->0}) ==0 ,x,t][[1]] //Simplify;
xGen[t_]= ( x[t] /.genSol)
:[font = text; inactive; preserveAspect]
Recall the form of the particular solution.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
xPart[t]
:[font = text; inactive; preserveAspect]
The complete solution is:
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
xTot[t_] = xGen[t] + xPart[t];
Variables[xTot[t]]
:[font = text; inactive; preserveAspect]
We use {C[1],C[2]} to determine the relative amplitudes of the individual solutions.
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
(* Make some arbitrary choices here. *)
values={C[1]->1, C[2]->1, w0->1, w-> 3 w0/2, b->w0/5, F->1};
:[font = text; inactive; preserveAspect]
Let's examine the total motion:
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
Plot[ (xTot[t] //Re) //.values //Evaluate
,{t,0,6 Pi}
];
:[font = text; inactive; preserveAspect]
and see how this is comprised of the General and Particular solutions:
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
Plot[ ({xGen[t],xPart[t],xTot[t]} //Re) //.values //Evaluate
,{t,0,6 Pi}
,PlotStyle->colorList
];
:[font = subsection; inactive; noKeepOnOnePage; preserveAspect]
Part e) Extra:
:[font = text; inactive; preserveAspect]
Let's examine this in phase space:
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
({xTot[t],xTot'[t]} //Re) //.values /.{t->2} //N
:[font = text; inactive; preserveAspect]
Here is a 2-D version:
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect]
ParametricPlot[ ({xTot[t],xTot'[t]} //Re) //.values //Evaluate
,{t,0,12 Pi} ];
:[font = text; inactive; preserveAspect]
Here is a 3-D version:
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect; endGroup]
ParametricPlot3D[ ({xTot[t],xTot'[t],t} //Re) //.values //Evaluate
,{t,0,12 Pi}
,BoxRatios->{1,1,3}];
:[font = section; inactive; Cclosed; noKeepOnOnePage; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup]
Problem 4: RLC Solution via Laplace Transform
:[font = text; inactive; preserveAspect]
I left my comments in, but removed the Mathematica code. You may use my method if you like, or choose your own.
;[s]
4:0,1;39,2;50,1;113,0;114,-1;
3:1,16,12,Times,0,14,0,0,0;2,16,12,Times,0,14,65535,0,0;1,16,12,Times,2,14,65535,0,0;
:[font = text; inactive; preserveAspect; cellOutline]
Consider a RLC circuit consisting of a time dependent emf V[t], a resistor R, an inductor L, and a capacitor C, connected in series.
eq1= L q''[t]+ R q'[t] + q[t]/C == V[t]
a) Find the LaplaceTransform of q[t] for an arbitrary V[t].
b) Solve for the charge and current when V[t]=0.
c) Make a 2-dimensional plot of the charge and current as a function of time.
Make a 3-dimensional plot of the charge as a function of t and L.
;[s]
3:0,0;155,1;197,0;460,-1;
2:2,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,0;
:[font = subsubsection; inactive; noKeepOnOnePage; preserveAspect]
Remarks and Outline:
:[font = text; inactive; preserveAspect]
Although DSolve will solve the RLC differential equation, we use LaplaceTransform to illustrate how this can be used to solve certain differential equations.
:[font = subsubsection; inactive; Cclosed; noKeepOnOnePage; preserveAspect; startGroup]
Required Packages:
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect; endGroup]
Needs["Algebra`Trigonometry`"] ;
Needs["Calculus`LaplaceTransform`"];
:[font = subsubsection; inactive; Cclosed; noKeepOnOnePage; preserveAspect; startGroup]
Solution
:[font = input; dontNoPageBreakInGroup; noKeepOnOnePage; preserveAspect; endGroup]
Clear["Global`*"];
:[font = text; inactive; Cclosed; preserveAspect; cellOutline; startGroup]
a) Find the LaplaceTransform of q[t] for an arbitrary V[t].
:[font = text; inactive; Cclosed; preserveAspect; startGroup]
The differential equation for the charge q[t] in a RLC circuit is
:[font = text; inactive; preserveAspect]
Taking the Laplace transform of eq1, we get (this takes a while)
:[font = text; inactive; preserveAspect; endGroup; endGroup]
It follows from the algebraic solution of eq2 that the LaplaceTransform of q[t] is:
:[font = text; inactive; Cclosed; preserveAspect; cellOutline; startGroup]
b) Solve for the charge and current when V[t]=0.
:[font = text; inactive; Cclosed; preserveAspect; startGroup]
Let us consider the explicit solution for the charge when V[t]=0. The Laplace transform follows from sol
:[font = text; inactive; preserveAspect]
For the initial conditions
:[font = text; inactive; preserveAspect]
The solution for q[t] follows from taking the inverse Laplace transform
:[font = text; inactive; preserveAspect]
The expression for the charge is rather cumbersome but can be simplified if we define the frequency
-w_0^2=(-4L+C R^2 )/(4 L^2 C). This notation is implemented by the rule
:[font = text; inactive; preserveAspect]
We also have the inverse rule:
:[font = text; inactive; preserveAspect]
With this change in notation, the expression for the charge simplifies to
:[font = text; inactive; preserveAspect; endGroup; endGroup]
The current follows from the time derivative of the charge,
:[font = text; inactive; Cclosed; preserveAspect; cellOutline; startGroup]
c) Make a 2-dimensional plot of the charge and current as a function of time.
Make a 3-dimensional plot of the charge as a function of t and L.
:[font = text; inactive; Cclosed; preserveAspect; startGroup]
Consider the parameters
:[font = text; inactive; preserveAspect]
for the plots of the charge and current.
:[font = text; inactive; preserveAspect]
To study the effects of inductance on the charge we consider a 3-dimensional plot of the charge as a function of the variables time and inductance. For the parameters
:[font = text; inactive; preserveAspect; endGroup; endGroup; endGroup]
the plot of the charge is
^*)