# ss

Convert digital filter to state-space representation

## Syntax

``````[A,B,C,D] = ss(d)``````

## Description

example

``````[A,B,C,D] = ss(d)``` converts a digital filter, `d`, to its state-space representation.The state-space representation of a filter is given by $\begin{array}{c}x\left(k+1\right)=Ax\left(k\right)+Bu\left(k\right),\\ y\left(k\right)=Cx\left(k\right)+Du\left(k\right),\end{array}$where x is the state vector, u is the input vector, and y is the output vector.```

## Examples

collapse all

Design a lowpass IIR filter of order 6. Specify a normalized passband frequency of $0.2\pi$ rad/sample. Compute the state-space representation of the filter.

```d = designfilt('lowpassiir','FilterOrder',6,'PassbandFrequency',0.2); [A,B,C,D] = ss(d)```
```A = 6×6 1.5640 -0.9294 0 0 0 0 1.0000 0 0 0 0 0 0.1795 0.0036 1.6097 -0.8112 0 0 0 0 1.0000 0 0 0 0.0020 0.0000 0.0408 0.0021 1.6956 -0.7409 0 0 0 0 1.0000 0 ```
```B = 6×1 0.0913 0 0.0046 0 0.0001 0 ```
```C = 1×6 0.0020 0.0000 0.0408 0.0021 3.6956 0.2591 ```
```D = 5.2030e-05 ```

## Input Arguments

collapse all

Digital filter, specified as a `digitalFilter` object. Use `designfilt` to generate a digital filter based on frequency-response specifications.

Example: ```d = designfilt('lowpassiir','FilterOrder',3,'HalfPowerFrequency',0.5)``` specifies a third-order Butterworth filter with normalized 3 dB frequency 0.5π rad/sample.

## Output Arguments

collapse all

State matrix, returned as a matrix.

Data Types: `double`

Input-to-state matrix, returned as a matrix.

Data Types: `double`

State-to-output matrix, returned as a matrix.

Data Types: `double`

Feedthrough matrix, returned as a matrix.

Data Types: `double`

## Version History

Introduced in R2014a