# Impulse response of a second order LTI

I have a set of measurement which I want to model with 2nd-order difference equations (first order eqs don't model well enough).

The equation is

$$y[n] = \alpha_1 y[n-1] + \alpha_2 y[n-2] + \beta_0 x[n] + \beta_1 x[n-1]$$

I want a generic formula for the impulse response.

I did a derivation, but being a total DSP beginner, I'm not sure whether it's correct or I'm missing some bits:

The transfer function is:

\begin{align} H(z) &= \displaystyle \frac{Y(z)}{X(z)} \\ &= \frac{\beta_0 + \beta_1 z^{-1}}{1 - \alpha_1 z^{-1} - \alpha_2 z^{-2}} \\ &= \frac{\beta_0 z^2 + \beta_1 z}{z^2-\alpha_1 z -\alpha_2 } \\ &= \frac{A_1 \, z}{z-p_1} + \frac{A_2 \, z}{z-p_2} \\ &= A_1\frac{1}{1-p_1 z^{-1}} + A_2\frac{1}{1-p_2 z^{-1}} \\ \end{align}

where $$p_{1,2}$$ are the poles and $$A_1$$ and $$A_2$$ can be calculated using partial fraction expansion.

Therefore the impulse response is

$$h[n] = \big(A_1 p_1^n + A_2 p_2^n \big) u[n],$$

where $$u[n]$$ is the discrete step function.

Is this ok?

• Hi! Your $H(z)$ shall better use powers of $z^{-1}$ but that's a minor issue. The problem is how do you determine those coefficients $\alpha$ and $\beta$... – Fat32 Oct 2 '18 at 9:24
• @Fat32 I used least squares: minimizing the distance between the measured curve and the one given by the model with parameters $\alpha_1, \alpha_2, \beta_1, \beta_2, y_0$ and $y_1$. Is it there a more principled approach? – doburupegu Oct 2 '18 at 9:30
• there are many approaches but a least squares approach is very common. So what's your question ? (is this ok?) – Fat32 Oct 2 '18 at 9:36
• Yes, I'd like to know wheter the impulse response is ok. – doburupegu Oct 2 '18 at 9:43
• This an ok approach if you have a pair of real poles, but typically you end up with a complex conjugate pair, in which case. both partial impulse responses would be complex as well which is awkward. It also doesn't work for a double real pole (i.e. r1 = r2) – Hilmar Oct 2 '18 at 11:24