The Resonant Filter

Demos with Positive Impact  

NSF DUE 9952306

Objective: To model and analyze the behavior of a resonant filter, including the solution of a second-order, constant coefficient differential equation, the notions of a transient and a steady state solution, and the idea of resonance.

Level: Sophomore/Junior/Senior in a Differential Equations or a Mathematical Modeling course.

Prerequisites:  Familiarity with techniques for solving second order differential equations (for example from Boyce & DiPrima, (6th ed.) Sections 3.8 & 3.9 or Zill (7th ed), Chapter 5). Acquaintance with basic circuit elements as discussed in a first course in differential equations. An introduction to numerical solution of differential equations would be helpful. 

Platform: A PC; custom software (developed using C++) is included.

Instructor's Notes:

The resonant filter is a circuit element containing a resistor with resistance R, a capacitor with capacitance C, an inductor with inductance L and a voltage source. Its response can be modeled by a second-order,  constant-coefficient, non-homogeneous second order differential equation

where q(t) is the charge on the capacitor at time t and Vin(t) is the (known) voltage from the input source.   The equation can be reforumlated in terms of current, i(t), using the relation that i'(t) = q(t).  Differentiating, we obtain an equivalent equation in terms of the current in the circuit,


Let Vout(t) represent the voltage drop across the resistor.  The relationship between the voltage and current is given by Vout(t) = R i(t).  Thus, the second order differential equation equation, represented in terms of Vout is


A program has been developed which takes as parameters the circuit elements, the source, and the initial conditions.  This program provides an interactive utility for a numerical simulation of the effect on the output by varying the parameters and the input signal.  

The program displays three components; the control panel, a graph of the input signal, and a graph of the output signal, represented by y(t). These are displayed in Figure 1.  

Figure 1. Simulation of RLC filter with 
R = 0.52, L = 0.215, C = 0.215, y(0) = 1,
y'(0) = 0, and input signal

Values for L, C, and R are controlled by sliders.  Initial data are controlled by user input and there are options for setting the viewing scale.  Three input signals of the form are allowed with controls for amplitude A, frequency , and phase shift .  The initial value problem is solved using a choice of the fixed step size Fourth Order Runge-Kutta algorithm or the variable step size Runge-Kutta-Fehlberg algorithm and the output function is graphed.  Each numerical routine provides user control over step size.  A slider controls the end time and the preferred frequency for the filter is calculated and displayed.

The accompanying help file, accessible by clicking the help button on the control panel, provides detailed instructions. (To see the help file click here.)

DEMO 1:  A basic demo involves simply illustrating the solution to an initial value problem that models the resonant filter with one input signal.  Holding all parameters fixed except one, it is easy to investigate the effect on the output signal from changing the value of one of the physical parameters.  Such an experiment is shown in Figure 2.

Figure 2.  Effect on output from varying C.

Aside from showing the numerically computed solution to the second order differential equation that describes the resonant filter, there are three other useful demonstrations that this software can facilitate.

DEMO 2:  Solutions of a second order differential equation with constant coefficients and a sinusoidal forcing function decompose into two  components--a transient solution and a steady state solution. Simply sliding the bars for the initial data shows quite clearly the presence of a transient solution that depends on the initial data, and a steady state solution that is unaffected by changes in the initial data.  Figure 3 shows the output signal for an RLC filter with R = 0.52, L = 0.215, C = 0.215, y(0) = 1,
y'(0) = 0, and input signal obtained by varying the initial conditions.  Observe the initial transient solution and the steady state that does not change.

y(0) = 1, y'(0) = 0

y(0) = .5, y'(0) = 0

y(0) = -1, y'(0) = 2

Figure 3.  Effect on output from varying initial conditions.

DEMO 3:  This demo is useful for illustrating the phenomenon of resonance in an electrical device.  Although resonance is undesirable in many mechanical systems, such as a spring mass system, many electrical devices such as radios would not function properly without the phenomenon of resonance.

Choose an input signal with a certain frequency.  Fix the resistance and inductance.  Slide the capacitance slider and observe the changes in the output curve as the preferred frequency changes. Notice that the amplitude of the steady state signal is largest when the preferred frequency is close to the frequency of the input signal.  We can think of the capacitor as a tuner.

We can use the software to simulate a primitive radio.  Assume that volume is roughly proportional to amplitude and suppose we wish to pick up a radio station at a particular frequency (the input frequency).  By adjusting the capacitor so that the amplitude is the highest (this will occur when the preferred frequency is the same as the input frequency), we have simultaneously tuned in the station broadcasting at our preferred frequency and tuned out stations broadcasting at other frequencies.

DEMO 4:  Choose three different input signals with different frequencies. Set the resistance to a low value, and slide either the inductance or capacitance values so that the preferred frequency varies across the frequencies of your input signals. You will be able to visually pick out the frequencies that correspond to the input frequencies. It is another nice demonstration of a primitive method for tuning a radio.

In a course on scientific simulation, we had students construct a program like this. They were given tables of data formed by the sum of periodic signals and used their program to determine the frequencies of the original signals.

Material Included:

A zipped file with all requisite material is available; see below. This file contains the program, which should run on any recent PC, the help file which describes the program interface as well as the mathematical details of the model and the resonance phenomenon. Also included is a complete commented source code for those who wish to modify the program. There is no installation process; you need only unzip the package in a convenient directory.

To download the zipped file click here.

Once the files have been extracted, the utility is the executable file entitled LRC Circuit.exe.  To run the program, double click the program icon. 

This software can be used either as a classroom demonstration or in a lab situation. It is recommended that if you use this with students in a lab that you prepare a handout of experiments for students to perform and report on.

Other Resource: is a java applet that illustrates resonance in an RLC circuit.  


Davis, Paul, Differential Equations for Mathematics, Science, and Engineering, Prentice Hall, 1992.

Edwards, C. Henry and David E. Penney, Differential Equations:  Computing and Modeling, Second Edition, Prentice Hall, 2000.

Boyce, William E. and Richard C. Diprima, Elementary Differential Equations, 6th Edition, John Wiley & Sons, 1996.

Zill, Dennis G., A First Course in Differential Equations with Modeling Applications, 7th Edition, Brooks-Cole, 2000.

Credits:  This demo was submitted by 

Michael O'Leary
Department of Mathematics 
Towson University

and is included in Demos with Positive Impact with his permission. The work of Michael O'Leary was supported by the National Science Foundation, under grant DUE 9952625.

7/24/02  DRH      last updated 5/22/2006 (DRH)