# Finding the poles of a system from a difference equation in MATLAB

I have a system tha is described by the following difference equation:

$y(n) + 0.3y(n-1) - 0.3y(n-2) = 0.5x(n) - x(n-1)$

How can i compute, using MATLAB (e.g. with roots function), the poles of the system?

-

## 1 Answer

You can perform a $z$-transform, obtain the discrete transfer function and find the roots of the denominator: (assuming $x$ is the input and $y$ is the output) $$y(k+2) + 0.3y(k+1) - 0.3y(k) = 0.5x(k+2) - x(k+1) \leadsto G(z) = \frac{Y(z)}{X(z)} = \frac{z(0.5z-1)}{z^2+0.3z-0.3}$$ then you can use roots([1 0.3 -0.3]) or obtain the discrete time state space equations and find the eigenvalues of the $A$ matrix.

-
thanx for your answer! But isn't ${z(0.5z-1)}/(z^2+0.3z-0.3)$ the correct transfer function in my example? – nikos Dec 6 '11 at 18:54
@nikos Yes, sorry for the mistake. Correcting right away. – user13838 Dec 6 '11 at 18:58