This is a brief tutorial showing how to use differential equations to do make predictions about the state of a simple dynamic analogue electronics circuit. I have ported this post over from my discontinued Wordpress blog, as some readers may find the information useful.
Put simply, a differential equation is any equation that contains derivatives. A derivative is basically a gradient, and so it is an equation that describes a system containing something that changes. In audio, this will likely be something that changes over time (t), so an example might be
I looks kinda like a polynomial, but with various order derivatives. We’d call this example a second order differential equation, as the highest order derivative is 2.
I quickly want to move onto a real world example, showing some useful stuff we can do with differential equations. For this, I’m going to use simple electronic components in a circuit and then try and predict the state of the circuit at a given time. I’m going to use basic analogue electronic components for my first realworld example, as digital filter theory is rooted in basic analogue electronics theory.
The complex impedance () of a circuit is made up of real resistive terms () and imaginary reactive terms () …
The reactance term comes from the combination of inductance and capacitance. Like resistance, capacitance and inductance are inherent properties of electronic components. The capacitative effect comes from built up electric field that resists voltage changes. The inductive effect comes from the build up of magnetic field that resists changes in current. Reactance effects are only exhibited when circuit conditions change. Therefore, we can use differential equations to predict the state of a circuit after a change. For the following example, the change is the circuit being switched on.
Consider a simple circuit containing a prefect voltage source, a resistor and an inductor …
When the circuit is switched on, the inductor chokes the initial burst of current, giving rise to a gradual increase in current through the inductor until a maximum value is reached.
One way to visualise the current flow through this circuit is to build it and measure it, but this is a bit of a faff. Another way is to use electronic simulation software. For simple circuits (and even for relatively complex ones too) I am a huge fan of the excellent and free web app, CircuitLab. CircuitLab allows the user to just drag and drop various components, set their values, then produce simulation plots like that shown below.
The plot shows that the rise in current through the inductor is not linear with time. This is because the relationship between the inductance (L), voltage (V), and current (I) is differential  it changes over time …
We will now see if we can predict the current for any given time analytically using differential equations. We know from Kirchoff’s Voltage Law that the sum total voltage drop across series components (VR and VL) equals the supply voltage (VS) …
We want to predict the current, so using Ohm’s law (V=IR), we can express this in terms of current (I) …
The next thing we want to do is get this into a suitable form for integration so we can remove the differential terms (dI and dt) and find a solution. THe first step is to split dI and dt …
… then separate the rest of the variables …
This is now in a suitable form for integration.
This is a great time to introduce a web app that I find particularly useful, Wolfram Alpha. This tool can be used to perform calculus. It will show the intermediate steps towards a solution, so there is no blackbox trickery to get in the way of our understanding. I have posted a screenshot of the output of the web app when asked to integrate the lefthandside (LHS) of the above equation. It saves all the typing anyway!
Integration of the righthandside (RHS) is trivial, so we end up with the following …
We are still trying to solve this for current, so the next step is to isolate the logarithmic term so that both sides of the equation can be easily exponentiated …
Now simply exp() both sides …
Now save a little writing by using the following alias for K, where K is some constant term …
… and so …
This allows us to finally get the current term by itself …
Great! We can almost state the current at a given time after the circuit is switched on, but there are still some pesky unknown constant terms in K that would cause some uncertainty in the result. However, this is not a problem because we know the initial conditions at switch on. At time t=0, the current through the circuit I=0. Substituting this in …
And so it follows …
so …
Now we can determine the current at any given time after switch on!
It is then easy to check if our analytical solution matches our hardware equivalent by making a quick Matlab script …
1 2 3 4 5 6 7 

So there we have it. I differential equation solved that allows us to predict the behaviour of a real physical system.