Euler'S Method For Coupled Differential Equations RLC Circuits
Euler'S Method For Coupled Differential Equations RLC Circuits
(t) t
I(t + t) = I(t) +I
(t) t
(13)
where rst derivatives have been indicated by primes. In the improved
Euler method the derivatives q
(t) and I
(t) +q
(t + t)]
and
1
2
[I
(t) +I
(t + t)] .
Note that: I(t) q
0
=
1
LC
_
1
R
2
C
4L
_
1/2
. (15)
The computer-generated curve of Fig. 4 is the approximate solution
obtained using the improved Eulers method. The gradually decaying
oscillations of the curve agree with the general form of the exact solution,
in which an oscillatory factor, sin
0
t, is multiplied by a damping factor
exp[(R/2 L)t]. As long as R
2
C/4L is much less than one, then Eq. (15)
which gives a value for
0
, reduces to
0
1
LC
;
_
for R << (4L/C)
1/2
_
; (16)
where
0
is 2 times the frequency of the free oscillations. The period T
of the oscillations is given by:
T =
2
0
2
LC . (17)
The appearance of the damping factor e
(R/2L)t
, in Eq. (14), implies that
the envelope i.e., the non-oscillatory curve drawn tangent to the solution
(see the hand-drawn dotted curve in Fig. 4), should fall to a fraction
1/e 0.368 of its initial value after a time
=
2L
R
. (18)
By examining the expressions for
0
in Eq. (16) we see that
0
will be a
real number only if
1
R
2
C
4L
> 0 ,
which therefore requires that:
R < (4L/C)
1/2
. (19)
If R exceeds the critical value
_
4L/C. then
0
becomes imaginary and
the factor sin
0
t is replaced by the exponential of a real number. For
this overdamped case the solution becomes a pure decaying exponential
and no longer oscillates. For this reason, when R has the borderline value,
R =
_
4L/C, the circuit is said to be criticall damped.
10
MISN-0-351 7
T
I
M
E
C
U
R
R
E
N
T
.
0
0
0
0
.
0
0
0
0
.
1
.
0
0
0
0
-
.
2
3
7
5
.
2
.
0
0
0
0
-
.
3
9
3
1
.
3
.
0
0
0
0
-
.
4
3
4
8
.
4
.
0
0
0
0
-
.
3
6
2
7
.
5
.
0
0
0
0
-
.
2
0
5
4
.
6
.
0
0
0
0
-
.
0
1
0
5
.
7
.
0
0
0
0
.
1
6
9
1
.
8
.
0
0
0
0
.
2
8
9
4
.
9
.
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0
0
0
0
.
0
3
5
3
.
4
8
.
0
0
0
0
.
0
1
1
1
.
4
9
.
0
0
0
0
-
.
0
1
3
8
.
5
0
.
0
0
0
0
-
.
0
3
2
8
.
5
1
.
0
0
0
0
-
.
0
4
1
8
.
5
2
.
0
0
0
0
-
.
0
3
9
4
.
5
3
.
0
0
0
0
-
.
0
2
7
2
.
5
4
.
0
0
0
0
-
.
0
0
9
3
. .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
R
=
.
2
0
0
0
0
L
=
2
.
0
0
0
0
0
C
=
2
.
0
0
0
0
0
D
T
=
1
.
0
0
0
0
0
N
=
5
5
.
0
0
0
0
0
V
0
=
.
0
0
0
0
0
W
=
.
0
0
0
0
0
t
1
t
2
t
3
t
4
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Figure 4. Computer output for the free underdamped oscil-
lator (hand-drawn solid line). Also shown is the exponential
damping factor (dashed line), computed directly from its
exact formal expression. The times t
1
,...,t
4
are one period
apart.
2b. Sinusoidal Applied Voltage. If the applied voltage is a sinu-
soidal function of time, then forced oscillations occur in the RLC circuit.
When the applied voltage is given by V
a
= V
0
sin t, then Eq. (12) again
has an exact solution. If the initial conditions are chosen properly, the cur-
rent is a sinusoidal function of time, with the same oscillation frequency
11
MISN-0-351 8
as the applied voltage:
I = I
m
sin(t ) , (20)
I
m
=
V
0
Z
(21)
and the quantity Z is known as the impedance and is given by
Z =
_
R
2
+
_
L
1
C
_
2
_
1/2
. (22)
The quantity appearing in Eq. (20) is the phase shift which is the rela-
tive shift between the sine curves describing the applied voltage and the
current as functions of time; is given by
= tan
1
_
L
1
C
_
R
. (23)
If the initial conditions are chosen arbitrarily, the solution will not have
a purely sinusoidal time dependence. Generally these departures from a
sinusoidal shape occur at times close to t = 0 and then gradually disap-
pear. For this reason such initial departures from a sinusoidal shape are
known as transient currents. They occur whenever the initial conditions
are other than those consistent with the specic solution which is purely
sinusoidal [Eq. (20)]. Figure 5 shows a computer generated solution ob-
tained using the improved Eulers method. The initial conditions used in
this case (q
0
= 1 and I
0
= 0), are such that there evidently is a transient
current present initially. After the transient current dies out, the ampli-
tude and phase of the resulting sine wave should be consistent with that
given by Eq. (21).
2c. Resonance in RLC Circuit . Like any system whose oscillations
are driven by an external source, an RLC circuit can resonate when the os-
cillation frequency of the external source matches the natural frequency
of the circuit. (The natural frequency is the frequency of free oscillations).
At resonance the amplitude of the current has a greater value than for
any other frequency. To nd the frequency at which the amplitude of
the current I
m
= V
0
/Z reaches its maximum, we must nd the frequency
for which Z is a minimum. Since the factor (L1/C)
2
which appears
in Eq. (22) can not be negative, Z will have its smallest possible value
when this factor is zero:
_
L
1
C
_
2
= 0 . (24)
12
MISN-0-351 9
T
I
M
E
C
U
R
R
E
N
T
.
0
0
0
0
.
0
0
0
0
.
2
.
0
0
0
0
.
0
1
4
6
.
4
.
0
0
0
0
.
0
8
9
6
.
6
.
0
0
0
0
.
1
8
1
0
.
8
.
0
0
0
0
.
2
4
4
7
.
1
0
.
0
0
0
0
.
2
4
7
2
.
1
2
.
0
0
0
0
.
1
7
4
1
.
1
4
.
0
0
0
0
.
0
3
3
5
.
1
6
.
0
0
0
0
-
.
1
4
6
4
.
1
8
.
0
0
0
0
-
.
3
2
4
7
.
2
0
.
0
0
0
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0
0
-
.
3
3
4
9
.
9
8
.
0
0
0
0
-
.
3
8
3
9
.
1
0
0
.
0
0
0
0
-
.
3
3
8
9
.
1
0
2
.
0
0
0
0
-
.
2
1
0
8
.
1
0
4
.
0
0
0
0
-
.
0
3
0
9
.
1
0
6
.
0
0
0
0
.
1
5
6
6
.
1
0
8
.
0
0
0
0
.
3
0
6
0
. .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
R
=
.
2
0
0
0
0
L
=
2
.
0
0
0
0
0
C
=
2
.
0
0
0
0
0
D
T
=
1
.
0
0
0
0
0
N
=
5
5
.
0
0
0
0
0
V
0
=
.
0
0
0
0
0
W
=
.
0
0
0
0
0
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Figure 5. Computer output for V
a
= V
0
sin t, showing
transient current present at times near t = 0. At much later
times the function becomes purely sinusoidal.
Solving Eq. (24) for yields
=
1
LC
. (25)
Note that the resonant frequency given by Eq. (25) is the same as the
approximate frequency of free oscillations, given by Eq. (16). This means
that the circuit shows the greatest response (maximum amplitude cur-
rent), when the applied voltage has a frequency equal to the natural
frequency, i.e., the frequency of free oscillations.
13
MISN-0-351 10
2d. Error Analysis . It is easy to compare the accuracy of the im-
proved and original Euler methods. In the improved Euler method we
nd q(t + t) using Eq. (7) in which the derivative dq/dt(t + t) needs
to be evaluated using the original Euler method, that is:
dq
dt
(t + t) =
dq
dt
(t) + t
d
2
q
dt
2
(t) (26)
Combining Eqs. (7) and (26) yields:
q(t + t) = q(t) + t
dq
dt
(t) +
t
2
2
d
2
q
dt
2
(t) . (27)
This is the correct Taylor expansion for q(t + t) up to terms second
order in t. The size of the t
2
term therefore, represents the dierence
between the original and improved Euler methods. Clearly, the accuracy
of both methods improves as t decreases. In the case of the RLC circuit
there are three time intervals of importance:
1. The period of free oscillations T = 2/
0
, where
0
is given by
Eq. (15).
2. The damping time for free oscillations, = 2L/R.
3. The period of the forced oscillations T = 2/, where is the fre-
quency of the applied voltage: V
a
(t) = V
0
sin t.
In order for either the original or the improved Euler method to give
accurate results, the time step t must be chosen to be small compared
to all three of these times.
3. Computer Implementation
3a. Input. The program
3
rst reads numerical values for the parame-
ters R, L, C, D, N, VO, and W, where
R = resistance
L = inductance
C = capacitance
DT = t (time step)
N = number of time steps
V0 = V
0
(amplitude of applied voltage)
W = (frequency of applied voltage).
3
For BASIC, FORTRAN, and C++ implementations, see this modules Computer
Program Supplement.
14
MISN-0-351 11
After reading the data and setting the initial conditions, the program
proceeds to advance the time in the sequence: 0, t, 2t, 3t, . . . , Nt.
For each new value of the time, it calculates new values of the charge
and current from the old values, using the improved Eulers method. In
addition to printing out a table of numerical values giving the current at
each time, the program also displays a graph of current against time.
3b. Output. The sample output shown in Figs. 4 and 5 were obtained
using two data cards with the following numerical values for the parame-
ters:
R L C DT N V0 W
Fig. 4 0.2 2.0 2.0 1.0 55.0 0.0 0.00
Fig. 5 1.0 8.0 8.0 2.0 55.0 0.7 0.25
In the rst case, since the applied voltage is zero (V0 = 0), and since
the values used for R, L, and C satisfy inequality (19), the solution is a
damped oscillatory one, as previously discussed. In the second case, the
sinusoidally varying applied voltage (V0 = 0), yields a solution which is
also sinusoidal, apart from a transient eect.
4. A Project: Examine Accuracy
4a. Accuracy For Free Oscillations. Run the program using a num-
ber of data sets all of which have V
0
= 0 and various values for the other
parameters. Verify that the inequality (19) must be satised if the solu-
tion is to be an oscillatory one, by using values of R slightly less than and
slightly greater than the value for critical damping. For the oscillatory
solutions, see if their detailed shape agrees with the form of the exact
solution (equation). To verify that the shape of the curve in Fig. 4 is
correct, we may identify the times t
1
, . . . , t
4
at which the current I has
its positive maxima: Reading Fig. 4, for example, we nd:
t
1
t
2
t
3
t
4
current (I) 0.2757 0.1818 0.0912 0.0522
time (t) 10.0000 21.0000 34.0000 46.0000
The time from t
1
to t
4
represents three periods, so we empirically nd
T = (t
4
t
1
)/3 = 12 sec. The theoretical value for the period may be
found using Eq. (15) which yields W = 0.494 and T = 2/ = 12.6 sec.
Carry out a similar analysis for your own data.
15
MISN-0-351 12
4b. Accuracy For Forced Oscillations, Resonances. Run the pro-
gram using a number of data sets with various values for the parameters,
except for VO which is kept at some xed nonzero value. In particular, try
a range of values for W with the other parameters held xed. See if the
maximum amplitude current is observed at the predicted resonant fre-
quency, [Eq. (25)]. Use enough values for W, above and below resonance,
to be able to plot by hand a resonance curve (amplitude of the current
versus frequency). Note, that when you vary W you should also vary DT,
since DT = 0.5/W. This will have the eect of giving the same number of
points per cycle for each run.
Acknowledgments
Preparation of this module was supported in part by the National
Science Foundation, Division of Science Education Development and
Research, through Grant #SED 74-20088 to Michigan State Univer-
sity.
A. Fortran, Basic, C++ Programs
All programs are at
http://www.physnet.org/home/modules/support_programs
which can be navigated to from the home page at
http://www.physnet.org
by following the links: modules support programs, where the pro-
grams are:
m351p1f.for, Fortran;
m351p1b.bas, Basic;
m351p1c.cpp, C++;
lib351.h, needed Library for C++ program;
16
MISN-0-351 ME-1
MODEL EXAM
1. Write an explanation of the improved Euler method for the numerical
solution of two coupled rst-order dierential equations of the form
dy
1
/dx = f
1
(y
1
, y
2
, x), dy
2
/dx = f
2
(y
1
, y
2
, x).
Examinee:
On your computer output sheet(s):
(i) Mark page numbers in the upper right corners of all sheets.
(ii) Label all output, including all axes on all graphs.
On your Exam Answer Sheet(s), for each of the following parts of items
(below this box), show:
(i) a reference to your annotated output; and
(ii) a blank area for grader comments.
When nished, staple together your sheets as usual, but include the origi-
nal of your annotated output sheets just behind the Exam Answer Sheet.
2. Submit the graphical results of your free-oscillation runs using the im-
proved Euler method, with your hand-annotated output demonstrating
that:
a. an oscillatory solution requires Eq. (19) when, done by graphically
displaying the shapes found for R values slightly below and above
the critical value;
b. the period of your oscillatory solution is correct, done by deduc-
ing the value of T from at least 3 periods and comparing to your
computed theoretical value; and
c. the general shape of the solution is correct, done by plotting it.
3. Submit the graphical results of your forced-oscillation runs using the
improved Euler method, with your hand-annotated output succinctly
demonstrating that:
a. your maximum current amplitude occurs at your formula-calculated
resonant frequency (shown on a plot of frequency versus current
amplitude).
17
MISN-0-351 ME-2
b. you properly used the same number of points per wave period for
each run.
INSTRUCTIONS TO GRADER
If the student has submitted copies rather than originals of the computer
output, state that on the exam answer sheet and immediately stop
grading the exam and give it a grade of zero.
Note that the award of points is set up in such a way that a student will
get 50% or less on the exam if the student does only computer work and
no physics.
18
19 20