# ss2zp

Convert state-space filter parameters to zero-pole-gain form

## Syntax

``[z,p,k] = ss2zp(A,B,C,D)``
``[z,p,k] = ss2zp(A,B,C,D,ni)``

## Description

example

````[z,p,k] = ss2zp(A,B,C,D)` converts a state-space representation $\begin{array}{l}\stackrel{˙}{x}=Ax+Bu\\ y=Cx+Du\end{array}$of a given continuous-time or discrete-time system to an equivalent zero-pole-gain representation $H\left(s\right)=\frac{Z\left(s\right)}{P\left(s\right)}=k\frac{\left(s-{z}_{1}\right)\left(s-{z}_{2}\right)\cdots \left(s-{z}_{n}\right)}{\left(s-{p}_{1}\right)\left(s-{p}_{2}\right)\cdots \left(s-{p}_{n}\right)}$whose zeros, poles, and gains represent the transfer function in factored form.```
````[z,p,k] = ss2zp(A,B,C,D,ni)` indicates that the system has multiple inputs and that the `ni`th input has been excited by a unit impulse.```

## Examples

collapse all

Consider a discrete-time system defined by the transfer function

`$H\left(z\right)=\frac{2+3{z}^{-1}}{1+0.4{z}^{-1}+{z}^{-2}}.$`

Determine its zeros, poles, and gain directly from the transfer function. Pad the numerator with zeros so it has the same length as the denominator.

```b = [2 3 0]; a = [1 0.4 1]; [z,p,k] = tf2zp(b,a)```
```z = 2×1 0 -1.5000 ```
```p = 2×1 complex -0.2000 + 0.9798i -0.2000 - 0.9798i ```
```k = 2 ```

Express the system in state-space form and determine the zeros, poles, and gain using `ss2zp`.

```[A,B,C,D] = tf2ss(b,a); [z,p,k] = ss2zp(A,B,C,D,1)```
```z = 2×1 -1.5000 0.0000 ```
```p = 2×1 complex -0.2000 + 0.9798i -0.2000 - 0.9798i ```
```k = 2 ```

## Input Arguments

collapse all

State matrix. If the system has r inputs and q outputs and is described by n state variables, then `A` is n-by-n.

Data Types: `single` | `double`

Input-to-state matrix. If the system has r inputs and q outputs and is described by n state variables, then `B` is n-by-r.

Data Types: `single` | `double`

Input-to-state matrix. If the system has r inputs and q outputs and is described by n state variables, then `C` is q-by-n.

Data Types: `single` | `double`

Feedthrough matrix. If the system has r inputs and q outputs and is described by n state variables, then `D` is q-by-r.

Data Types: `single` | `double`

Input index, specified as an integer scalar. If the system has r inputs, use `ss2zp` with a trailing argument `ni` = 1, …, r to compute the response to a unit impulse applied to the `ni`th input. Specifying this argument causes `ss2zp` to use the `ni`th columns of `B` and `D`.

Data Types: `single` | `double`

## Output Arguments

collapse all

Zeros of the system, returned as a matrix. `z` contains the numerator zeros in its columns. `z` has as many columns as there are outputs (rows in `C`).

Poles of the system, returned as a column vector. `p` contains the pole locations of the denominator coefficients of the transfer function.

Gains of the system, returned as a column vector. `k` contains the gains for each numerator transfer function.

## Algorithms

`ss2zp` finds the poles from the eigenvalues of the `A` array. The zeros are the finite solutions to a generalized eigenvalue problem:

```z = eig([A B;C D],diag([ones(1,n) 0]); ```

In many situations, this algorithm produces spurious large, but finite, zeros. `ss2zp` interprets these large zeros as infinite.

`ss2zp` finds the gains by solving for the first nonzero Markov parameters.

 Laub, A. J., and B. C. Moore. "Calculation of Transmission Zeros Using QZ Techniques." Automatica. Vol. 14, 1978, p. 557.