# Difference equation when transfer function expressed as poles and zeros

The transfer function $H(z)$:

$$H(z) = \frac{Y(z)}{X(z)} = \frac {b_0 + b_1 z^{-1} + b_2 z^{-2}} {1 + a_1 z^{-1} + a_2 z^{-2}} \tag{1}$$

Has difference equation:

$$y[n] = b_0 x[n] + b_1 x[n-1] + b_2 x[n-2] - a_1 y[n-1] - a_2 y[n-2] \tag{2}$$

How would you compute the difference equation when $H(z)$ is expressed as poles and zeros without expanding brackets:

$$H(z) = g \frac {(z - d_0)(z - d_1)} {(z - c_0)(z - c_1)} \tag{3}$$

I'm happy to assume real poles and zeros for the sake of simplicity. I know that when performing a cascade on a computer that the output of the first section is fed to the second and second order sections are used. I'm interested in the maths though.

What I'm ultimately trying to do is get the difference equation for this expression direct without expansion:

$$H(z) = g \prod_{k=1}^{K} \frac {b_{k0} + b_{k1} z^{-1} + b_{k2} z^{-2}} {1 + a_{k1} z^{-1} + a_{k2} z^{-2}} \tag{4}$$

• What is $g$ in $H(z)$ ? – Gilles May 18 '16 at 9:34
• @Gilles: $g$ is the (real-valued) gain factor (which is not determined by the poles and zeros). – Matt L. May 18 '16 at 9:37
• Why "without expanding brackets"? BTW, your notation is a bit strange, because $d_i$ are not the zeros, and $c_i$ are not the poles, but their inverses are. – Matt L. May 18 '16 at 9:40
• @Matt L, thanks matt, given $d_i$ and $c_i$ are constants I supposed the maths would still hold either way, I've updated my question to be (hopefully) less strange :-) – keith May 18 '16 at 10:03
• The point that's still unclear to me is what keeps you from doing the obvious, i.e., expanding the brackets. If you want the difference equation then that's what you'll have to do. – Matt L. May 18 '16 at 10:08

If I understood your question right, you would like to obtain a Linear Constant Coefficient Difference Equation (LCCDE) representation of a given system from its given System Transfer Function, $H(z)$, when it's expressed in a pole-zero product form such as: $$H(z) = g \frac {(z - d_0)(z - d_1)} {(z - c_0)(z - c_1)} \tag{1}$$

instead of a, more directly apparent, power series form such as: $$H(z) = \frac {b_0 + b_1 z^{-1} + b_2 z^{-2}} {1 + a_1 z^{-1} + a_2 z^{-2}} \tag{2}$$

As known, the latter form can be directly converted to its corresponding LCCDE representation from the coefficients ${b_k}$ and ${a_k}$ as follows: $$y[n] + a_1 y[n-1] + a_2 y[n-2] = b_0 x[n] + b_1 x[n-1] + b_2 x[n-2]$$ Where the pattern of conversion speaks for itself, without a need of further description.

Now, we'd like to know whether one can obtain a similar conversion from the pole-zero form into the LCCDE without expanding the product?

Well yes and no! Depending on how you consider the process of computing the coefficents. If your intention is on the fact that you do not want to algebricaly perform the paranthesis expansion operation, but instead use a machanism that computes each coefficient separately by a set of arithmetic operations; then yes you can devise such a method to, for example, compute $a_3$ or $b_5$ without computing any other terms. And No, eventually you must always compute the coefficient $a_k$ that multiplies $z^{-k}$ so as to find the coefficient that multiplies $y[n-k]$, hence you need to always expand the brackets and compute multipliers of $z^{-k}$ in one or the other way.

Then I want to present here a simple method to find those coefficients : given a polynomial in the product of zeros form: $$p(x) = (x-a)(x-b)(x-c)$$ we can perform the following operation to get its coefficients in the expanded form $$p(x) = d_0 x^3 + d_1 x^2 + d_2 x + d_3$$

$$d[k] = (1 -a)\star(1 -b)\star(1-c)$$ where $k =0,1,2,3$ in this particular case.

As clearly seen this is a discrete convolution operation, where each multiplier bracket is turned into a respective convolution operand. For which a simple MATLAB line to compute $d[k]$ would be:

 d = conv([1 -a],conv([1 -b],[1 -c]));


where a, b, and c would be replaced by their numeric values or if you're competent in the symbolic math capability, you could instead obtain a pure symbolic result for the coeffients $d_k$, which would therefore give you a way to compute LCCDE coefficients from pole-zero products of $H(z)$ in a rather roundabout way.

Finally, the computations for a power of $z^{-1}$ products is basicly the same if you describe the product as $$P(z) = (1 - az^{-1})(1-bz^{-1})(1-cz^{-1})$$ and, $$P(z) = d_0 + d_1 z^{-1} + d_2 z^{-2} + d_3 z^{-3}$$

where again $$d[k] = (1 -a)\star(1 -b)\star(1-c)$$

Considering a polynomial function written as:

\begin{align} P(z) = (z-a_1)(z-a_2)\dots(z-a_{n-1})(z-a_n) \end{align}

you can rewrite it as:

\begin{align} P(z) = z^n - z^{n-1}\sum\limits_{i<n}a_{i}+z^{n-2}\sum\limits_{i\neq j}^{i,j\leq n}a_ia_j -z^{n-3}\sum\limits_{i\neq j \neq k}^{i,j,k\leq n}a_ia_ja_k\dots \end{align}

For clarification, let's assume $n=3$. We obtain:

\begin{align} P(z) = z^3-z^{2}(a_1 + a_2 + a_3)+z(a_1a_2+a_2a_3+a_1a_3)-a_1a_2a_3 \end{align}

For $n=4$:

\begin{align} P(z) = &z^4-z^3(a_1+a_2+a_3+a_4)+z^2(a_1a_2+a_1a_3+a_1a_4+a_2a_3+a_2a_4+a_3a_4)-\\&-z(a_1a_2a_3+a_1a_2a_4+a_1a_3a_4+a_2a_3a_4)+a_1a_2a_3a_4 \end{align}

You can obtain coefficients for differential equation from the formula above.