# 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$... Commented Oct 2, 2018 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? Commented Oct 2, 2018 at 9:30
• there are many approaches but a least squares approach is very common. So what's your question ? (is this ok?) Commented Oct 2, 2018 at 9:36
• Yes, I'd like to know wheter the impulse response is ok. Commented Oct 2, 2018 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) Commented Oct 2, 2018 at 11:24

Your procedure is correct. But, you need to consider two things:

(i) Pole/zero locations.

(ii) Whether the system is causal or non-causal.

Your final answer is OK provided you consider that all the zeros and poles are distinct and the underlying LTI system is causal.

You will get two more solutions if the LTI system is considered non-causal, even if you assume to have distinct zeros and poles.

Hope this helps.

In case of complex roots the impulse response must be declining sin function and your h[n] must approach upper border of your step u[n] by swinging above and below. I don't see how it is possible from your final expression. Theoretically there can be only two analytical expressions of impulse response. Having all parameters, why not to find response on approximation to Dirac impulse 0,1,0,...,0. By looking at reaction you can narrow it to either of these two cases and identify parameters by least squares. Transfer functions are derived via so-called Laplace transforms, which are applicable to continuous form i.e. differential equation. Strictly speaking you have to write your model in a form of differential equations and use its coefficients for transfer functions.