How to

Solve a differential equation with forcing function



The easy way is to use complex numbers


Finding the complementary function is straightforward, but sorting out a particular integral using phase angles can be tough.  Complex numbers are the answer!

To make it all look easier, let us consider a numerical example

\ddot{x}+ 5\dot{x}+6x = \sin t
Now sin t is the real part of -j ejt

so we will consider x as C ejt, where C is likely to be complex.  We are only interested in the real part, so

we will take the real part of our final expression when we have worked out a value for C.


If we differentiate ejt we get jejt.

So the first and second derivatives of x are jx and -x respectively, so for

\ddot{x}+
                      5\dot{x}+6x = \sin t

we have

(-1 + 5j +6) x = -j ejt

i.e.

x=\frac{-j}{5+5j}e^{jt}=\frac{-j}{5(1+j)}e^{jt}
We rationalise this by multiplying top and bottom by (1 - j) to get

      
x=\frac{-j(1-j))}{5(1+j)(1-j)}e^{jt}=\frac{-j-1}{5(1^2+1^2)}e^{jt}
so
x = (-j - 1) ejt /10 = (-1 - j) (cos t + j sin t) /10

Finally we take just the real part, to get

x = -0.1 cos t + 0.1 sin t
I challenge you to work it out faster using the phase-shift!

The general case


We have
forcing
Remember that there are two parts to the solution, the 'Complementary function' and the 'Particular integral'.

For the first, we assume that the input is zero.  We look for solutions of the form x ect (where c might be complex) so that we can use the fact that the first and second derivatives will then be cx and c2x respectively.

When we substitute this function into the equation we get
e^{ct}(c^2 + 2 \zeta
                          \omega_n c + {\omega_n}^2) = 0
We solve the quadratic to get two values for c (though they might be equal roots.)

If they are real, the complementary function will be the sum of two exponentials, each multiplied by a constant to match up the initial conditions.

If they are complex, say if c = a +/- jb, then the complementary function will be
eat(A cos bt + B sin bt)
where constants A and B are chosen to match the initial conditions.

For the 'Particular integral' we apply the input function and look for any solution function that will fit.  It is fairly obvious that in this case the solution will be a mixture of the sine and cosine of omega t, but sorting out the values with be a trigonometric nightmare!

So we put our trust in complex numbers.

We know that the forcing function is the real part of
-j\frac{F_0}{m}e^{j\omega t}
(multiply it out, with the exponential replaced by (cos + j sin) to check)

so we look for a value of x of the form
(a + jb)e^{j\omega t}
where we will end by taking the real part of
(a + jb)(\cos \omega t+j\sin
                        \omega t)
So here goes.  From the differential equation we have
forcing
so
x(-\omega^2 +2\zeta \omega_n
                        j\omega+\omega_n^2)=-j\frac{F_0}{m}e^{j\omega
                        t}
and so
x=\frac{-j}{-\omega^2 +2\zeta
                        \omega_n
                        j\omega+\omega_n^2}.\frac{F_0}{m}e^{j\omega t}
It might look nasty, but that is really the fault of the way the equation was written. Most of the Greek characters are just numbers and the leading fraction is just a complex number.  To work it out we write it as
\frac{-j}{(\omega_n^2-\omega^2) +2\zeta
                        \omega_n j\omega}
and rationalise it.

Then we multiply out the complex numbers, take the real part and we are home!

To see that it is really not all that difficult, look again at the numerical example above.