Wednesday 6 May 2015

z transform - Converting poles/zeros to differential/difference equation solutions


Does anyone have a reference handy on how to convert poles and zeros of a system to differential/difference equations.


Here is a quick draft of math, but I am not sure if it's at all correct. First, solving the characteristic equation gives the eigen values (equal to poles). Applying rudimentary knowledge of differential equations, the solution regarding only the poles should be:


$$\text {Poles Diffrential}: p(t)= \sum_{i=1}^{n_1} c_ie^{t\times \text{p}_i} $$


$$\text {Poles Difference}:p[n]= \sum_{i=1}^{n_1} c_i\text{p}_i^n $$


Where the $p_i$ is the value of ith pole and C is some constant, possibly scaled to the inverse value of the number of poles, the index runs from 1 to $n_1$, the number of poles. I denote the solution that considers only poles/characteristic equation as $p(t)$. (To be exact, c is the input/initial value at time zero so we still have the denominator of characteristic equation as cz^0=c).


Next, zeros should be solved in respect to time/samples. This should be an easy task, considering that the input equation which zeros are solved from, directly outputs the signal. First solve the Y(z) (equivalent to the numerator of the transfer function):



$$Y[z]=\prod_{i=1}^{n_2}(z-q_i)$$


Where $q_i$ is the value of ith zero and $n_2$ the number of zeros. The function needs to still be converted to time doimain by converting each individual elements $az^{x}$ into $z[n(-x)]=a$. Things get more complicated when both elements are considered simultaneously. Unless my interpretation is incorrect, the input equation (used for zeros) acts as a signal that is fed into the recursive filter(poles portion). Thus the final interpretation can be had by simply convolving the equations (with $c_i=1$):


$$ \text {Zeros, Poles}: y[n] = p[n] * z[n] $$


Where the $p[n]$ and $z[n]$ from the preceding equations and $*$ is the convolution operator. To solve the differential equation variation, simply substitute $t$ in place of $n$ for zeros and the output.



Answer



Okay, I'm gonna attempt an answer to this while I am still convinced the question is ill-formed. I am answering the title of the question without really referring to the text of the question, which I don't understand.


First, for discrete-time: A general IIR (or even FIR in which all of the poles are at the origin, where $z=0$) transfer function is:


$$\begin{align} H(z) \triangleq \frac{Y(z)}{X(z)} & = H_0 \frac{(z-q_1)(z-q_2)(z-q_3)...(z-q_M)}{(z-p_1)(z-p_2)(z-p_3)...(z-p_N)} \\ \\ & = H_0 \frac{z^M (1-q_1 z^{-1})(1-q_2 z^{-1})(1-q_3 z^{-1})...(1-q_M z^{-1})}{z^N (1-p_1 z^{-1})(1-p_2 z^{-1})(1-p_3 z^{-1})...(1-p_N z^{-1})} \\ \\ & = z^{M-N} \ \frac{H_0 \ (1-q_1 z^{-1})(1-q_2 z^{-1})(1-q_3 z^{-1})...(1-q_M z^{-1})}{(1-p_1 z^{-1})(1-p_2 z^{-1})(1-p_3 z^{-1})...(1-p_N z^{-1})} \\ \\ & = z^{M-N} \ \frac{b_0 + b_1 z^{-1} + b_2 z^{-2} + b_3 z^{-3} + ... + b_M z^{-M} }{ 1 + a_1 z^{-1} + a_2 z^{-2} + a_3 z^{-3} + ... + + a_N z^{-N} } \end{align}$$


$N$ is the number of poles, $p_i$, and $M$ is the number of zeros, $q_i$.


The difference equation comes from moving a few of the above things around.



$$\begin{align} Y(z) & \left( 1 + a_1 z^{-1} + a_2 z^{-2} + ... + a_N z^{-N} \right) \\ & \quad = X(z) z^{M-N} \left( b_0 + b_1 z^{-1} + b_2 z^{-2} + ... + b_M z^{-M} \right) \end{align}$$


$$\begin{align} Y(z) = \ & b_0 z^{M-N} X(z) + b_1 z^{M-N-1} X(z) + b_2 z^{M-N-2} X(z) + ... \\ & \quad ... + b_M z^{-N} X(z) - a_1 z^{-1}Y(z) - a_2 z^{-2}Y(z) - ... - a_N z^{-N}Y(z) \end{align}$$


Inverting the Z Transform, this becomes


$$\begin{align} y[n] = \ & b_0 \ x[n+M-N] + b_1 \ x[n+M-N-1] + b_2 \ x[n+M-N-2] + ... \\ & \quad ... + b_M \ x[n-N] - a_1 \ y[n-1] - a_2 \ y[n-2] - ... - a_N \ y[n-N] \end{align}$$


For a causal system or filter, we cannot look into the future for any input sample $x[n]$. That means $M \le N$ so that there is no negative delays on the $x[n+M-N]$ term.


Often $M=N$ (the numbers of poles and zeros are the same) and you get the more familiar


$$\begin{align} y[n] = \ & b_0 \ x[n] + b_1 \ x[n-1] + b_2 \ x[n-2] + ... + b_N \ x[n-N] \\ & \quad - a_1 \ y[n-1] - a_2 \ y[n-2] - ... - a_N \ y[n-N] \end{align}$$


and the more familiar transfer function


$$\begin{align} H(z) & = H_0 \frac{(z-q_1)(z-q_2)(z-q_3)...(z-q_N)}{(z-p_1)(z-p_2)(z-p_3)...(z-p_N)} \\ \\ & = \frac{H_0 \ (1-q_1 z^{-1})(1-q_2 z^{-1})(1-q_3 z^{-1})...(1-q_N z^{-1})}{(1-p_1 z^{-1})(1-p_2 z^{-1})(1-p_3 z^{-1})...(1-p_N z^{-1})} \\ \\ & = \frac{b_0 + b_1 z^{-1} + b_2 z^{-2} + b_3 z^{-3} + ... + b_N z^{-N} }{ 1 + a_1 z^{-1} + a_2 z^{-2} + a_3 z^{-3} + ... + + a_N z^{-N} } \end{align}$$


That demonstrates where the difference equation (and the feedforward, $b_i$, and feedback, $-a_i$, coefficients) come from the poles, $p_i$, and zeros, $q_i$.



The problem remaining, which is the hard problem, is that I didn't bother to multiply it out. So you have to blast this out:


$$\begin{align} H_0 \ & (1-q_1 z^{-1})(1-q_2 z^{-1})(1-q_3 z^{-1})...(1-q_M z^{-1}) \\ & \quad = b_0 + b_1 z^{-1} + b_2 z^{-2} + b_3 z^{-3} + ... + b_M z^{-M} \end{align}$$


and


$$\begin{align} & (1-p_1 z^{-1})(1-p_2 z^{-1})(1-p_3 z^{-1})...(1-p_N z^{-1}) \\ & \quad = 1 + a_1 z^{-1} + a_2 z^{-2} + a_3 z^{-3} + ... + a_N z^{-N} \end{align}$$


You can see right away that $b_0 = H_0$ and that $a_0=1$ (I never really had an "$a_0$" term anyway), but you have to blast out the multiplication of the binomials to get the polynomials. You can also see that $b_M = (-1)^M H_0 q_1 q_2 q_3 ... q_M$ and $a_N = (-1)^N p_1 p_2 p_3 ... p_N$ That's not a simple expression, but I hope you understand what you must do here.


No comments:

Post a Comment

readings - Appending 内 to a company name is read ない or うち?

For example, if I say マイクロソフト内のパートナーシップは強いです, is the 内 here read as うち or ない? Answer 「内」 in the form: 「Proper Noun + 内」 is always read 「ない...