# ss

Convert digital filter to state-space representation

## Syntax

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

## 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

### State-Space Representation of a Lowpass IIR Filter

Design a lowpass IIR filter of order 6. Specify a normalized passband frequency of 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 = 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 = 0.0913 0 0.0046 0 0.0001 0 C = 0.0020 0.0000 0.0408 0.0021 3.6956 0.2591 D = 5.2030e-05 

## Input Arguments

collapse all

### d — Digital filterdigitalFilter object

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

### A — State matrixmatrix

State matrix, returned as a matrix.

Data Types: double

### B — Input-to-state matrixmatrix

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

Data Types: double

### C — State-to-output matrixmatrix

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

Data Types: double

### D — Feedthrough matrixmatrix

Feedthrough matrix, returned as a matrix.

Data Types: double