Difference Equations

From PrattWiki
Jump to navigation Jump to search

This page is very much a work in progress on showing how to find impulse responses of systems modeled with difference equations.


For second order difference equations with real-valued coefficients, there are three different possible forms of the homogeneous solution (and thus the impulse response) depending on the nature of the solutions of the characteristic polynomial:

$$\begin{align}\begin{array}{c|c}\mbox{Solutions of Characteristic} & \mbox{Form of Impulse Response}\\ \hline \hline\mbox{Two different real values} & K_1\gamma_1^n+K_2\gamma_2^n\\\mbox{Repeated real value} & K_1\gamma^n + K_2n\gamma^n\\\mbox{Complex Conjugate Pairs} & |\gamma|^nK\cos(n\angle \gamma + \phi)\mbox{ or}\\~ & |\gamma|^n\left(K_1\cos(n\angle \gamma)+K_2\sin(n\angle \gamma)\right)\end{array}\end{align}$$

where $$|\gamma|$$ is the magnitude of the solution to the characteristic polynomial and $$\angle \gamma$$ is the angle it makes with the positive real axis. There will also be a step function involved depending on the relative most-shifted versions of the input and output.

For the last case, it is often easier to get $$K_1$$ and $$K_2$$ using initial conditions and then relate them to the first form of the solution with:

$$\begin{align}K&=\sqrt{K_1^2+K_2^2}\\\phi&=-\mbox{atan}\left(\frac{K_2}{K_1}\right)\end{align} $$

For instance, imagine something like $$y[n]-y[n-1]+1.69y[n-2]=x[n]$$. The characteristic equation is $$\gamma^2-\gamma+1.69=0$$ which has roots of $$\gamma=0.5\pm 1.2j$$. The magnitude of the root is $$|\gamma|=1.3$$ and the angle (picking the + version of the imaginary part) is $$\angle\gamma=\mbox{arctan(1.2/0.5)}=1.176$$. This means the form of the impulse response would be:

$$\begin{align}h[n]&= 1.3^nK\cos(1.176n + \phi)u[n]\mbox{ or}\\~&=1.3^n\left(K_1\cos(1.176n)+K_2\sin(1.176n)\right)u[n]\end{align}$$