First Order ODE with Constant Forcing Functions

From PrattWiki
Jump to navigation Jump to search

Introduction

This page will look at solving first-order constant-coefficient ordinary differential equations with constant forcing functions. The main context for these equations is in switched RL or RC circuits with constant sources.

Differential Equation Simplification

There are many systems that will have some measurable quantity $$y(t)$$ related to an external forcing function $$f(t)$$ through the equation:

$$\begin{align*} a_1\,\frac{dy(t)}{dt}+a_0\,y(t)&=b_0\,f(t) \end{align*}$$

where $$a_i$$ and $$b_i$$ are constants. For now, let us assume that the forcing function is some constant $$f$$ such that the equation becomes:

$$\begin{align*} a_1\,\frac{dy(t)}{dt}+a_0\,y(t)&=b_0\,f \end{align*}$$

Now, for purposes that will become clear later, let us divide all three terms by $$a_0$$ (assuming that it is non-zero) to get:

$$\begin{align*} \frac{a_1}{a_0}\,\frac{dy(t)}{dt}+\,y(t)&=\frac{b_0\,f}{a_0} \end{align*}$$

From this equation, you can see that there are actually only two constants that matter, $$\frac{a_1}{a_0}$$ and $$\frac{b_0\,f}{a_0}$$. We will give them names and then we can re-write the equation with those new names:

$$\begin{align*} \mbox{Time Constant}&~\tau & \tau&=\frac{a_1}{a_0}\\ \mbox{Final Value}&~y_f & y_f&=\frac{b_0\,f}{a_0}\\ \mbox{New Equation}&~ &\tau\,\frac{dy(t)}{dt}+\,y(t)&=y_f \end{align*}$$

Particular Solution

The particular solution to a differential equation will resemble the forcing function. For instance, the particular solution to an nth order polynomial is an nth order polynomial and the particular solution to a sinusoid at a particular frequency is a sinusoid at that same frequency (potentially with a different amplitude and phase angle). The particular solution to a differential equation with a constant forcing function, then, will be a constant. We can solve for that constant by replacing $$x(t)$$ with a constant $$c_p$$ in the differential equation:

$$\begin{align*} \tau\,\frac{dy(t)}{dt}+\,y(t)&=y_f\\ \tau\,\frac{d(c_p)}{dt}+\,(c_p)&=y_f\\ \tau\cdot\,0+c_p&=y_f\\ c_p&=y_f \end{align*}$$

From this, we can see that $$c_p$$ is equal to $$y_f$$, the normalized version of the forcing function. We will momentarily see that this is also the final value of $$y(t)$$ which is why it is called $$y_f$$.

Homogeneous Solution

The homogeneous solution to a differential equation describes how the system can transition from some set of initial conditions to following the forced solution. In many cases, the system will not be able to immediately track the forcing function but needs some time to get there. As an example, if someone is sitting on a swing and you push them with a constant force, they cannot immediately move to the exact angle that will balance your force out with the force of gravity -- they have to move there. In a similar way, if you apply a constant voltage to an RC circuit where the capacitor was initially uncharged, it will take some time for the capacitor voltage to reach the source voltage.

The typical form of the homogeneous solution is $$y_h(t)=Ke^{st}$$ where $$K$$ is some constant and $$s$$ is an exponent. Note: the use of $$s$$ as the exponent in this case is forecasting the use of Laplace Transforms at some point in the future. Other symbols commonly used for the exponent are $$p$$, $$r$$, and $$\lambda$$; they would each take on the same values in this case, but would forecast other techniques in your future (for example, Lyapunov functions of linear algebra and eigenstuff).

Note that the homogeneous solution is a solution that works for the system if the forcing function were zero! That is to say, the particular solution above has already taken care of the right side of the equation; the homogeneous solution takes care of going from some set of initial conditions to tracking the forcing function. Given that:

$$\begin{align*} \tau\,\frac{dy_h(t)}{dt}+y_h(t)&=0\\ \tau\,(s\,K\,e^{st})+K\,e^{st}&=0\\ K\,e^{st}\,(s\tau+1)&=0 \end{align*}$$

For that last equation to hold, either $$K=0$$ (possible, but trivial), $$e^{st}=0$$ (not possible for all $$t$$), or $$s=-\frac{1}{\tau}$$. The latter is the only useful one, so we can write that:

$$ \begin{align*} y_h&=Ke^{-t/\tau} \end{align*} $$

Note: for a first-order system, the values of $$s$$ will be real; for second order equations and above, $$s$$ might include complex numbers and also may have repeated values, both of which complicate things. For real-valued first-order systems, $$s$$ will be a real number, which simplifies things.

Putting Solutions Together

We can now put the particular and homogeneous solutions together to get:

$$ \begin{align*} y(t)&=y_f+Ke^{-t/\tau} \end{align*}$$

To solve for the constant $$K$$, we need to know the value of $$y(t)$$ at some time - it does not need to be time $$t=0$$ however! Assuming we know $$y(t_i)=y_i$$ at some time $$t_i$$, we can solve for $$K$$ as follows:

$$ \begin{align*} y(t_i)=y_i&=y_f+Ke^{-t_i/\tau}\\ K&=\frac{y_i-y_f}{e^{-t_i/\tau}} \end{align*}$$

If we then substitute this into our general equation, we can get:

$$ \begin{align*} y(t)&=y_f+\frac{y_i-y_f}{e^{-t_i/\tau}}e^{-t/\tau}\\ y(t)&=y_f+(y_i-y_f)e^{-(t-t_i)/\tau} \end{align*}$$

Examples

Step Response of an RC Circuit

Assuming the input is a voltage source across a series RC circuit and the output is the voltage drop across the capacitor, the differential equation that models the system, based on KCL at the node between the capacitor and the resistor, is:

$$ \begin{align*} \frac{v_o(t)-v_i(t)}{R}+C\frac{dv_o(t)}{dt}&=0\\ \end{align*}$$

which can be re-arranged as:

$$ \begin{align*} RC\frac{dv_o(t)}{dt}+v_o(t)&=v_i(t)\\ \end{align*}$$

And if we are looking for a step response, $$v_i(t)=u(t)$$ meaning the source was off for a very long time before time 0 and then becomes 1 for all time after time 0. We therefore know that:

$$ \begin{align*} \tau&=RC & v_{o,f}&=1 & t_i&=0 & v_{o,i}&=0 \end{align*}$$

so that the voltage drop across the capacitor is:

$$ \begin{align*} v_{o,step}(t)=v_{o,f}+(v_{o,i}-v_{o,f})e^{-(t-t_i)/\tau}=1+(0-1)e^{-t/RC}=1-e^{-t/RC} \end{align*}$$

To be explicit about the fact that this is only valid for $$t>0$$, we can write:

$$ \begin{align*} v_{o,step}(t)=\left(1-e^{-t/RC}\right)\,u(t) \end{align*}$$