# ctffilt

## Syntax

## Description

filters the input data `y`

= ctffilt(`B,A`

,`x`

)`x`

using Cascaded Transfer Functions (CTF) defined by the numerator and denominator coefficients `B`

and
`A`

, respectively.

## Examples

## Input Arguments

## Output Arguments

## More About

## Tips

## Algorithms

The `ctffilt`

function uses the transposed direct form II structure
to implement the filter from the coefficients and gain in the cascaded transfer function
format.

Assume that the filter has *l* sections with coefficients *b*_{li} and *a*_{lj}, derived from the matrices `B,A`

in the CTF format, and
the scale value(s) `g`

. The values *i* – 1 and *j* – 1 denote the exponents of *z* of the numerator and
denominator polynomials in the *z*-domain, respectively. The
`ctffilt`

function normalizes *a*_{li} and *b*_{li} to *α*_{li} and *β*_{li}, respectively, ensuring that *α*_{l1} equals unity.

$$\begin{array}{l}{\beta}_{li}=\mathrm{sgn}({g}_{\text{S}})|{g}_{\text{S}}{|}^{1/L}{g}_{l}\frac{{b}_{li}}{{a}_{l1}},\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.05em}}i=1,2,\mathrm{...},m+1\\ {\alpha}_{lj}=\frac{{a}_{lj}}{{a}_{l1}},\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.05em}}\text{\hspace{1em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.05em}}\text{\hspace{1em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.05em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.05em}}j=1,2,\mathrm{...},n+1\end{array}$$

When you specify `g`

as a scalar,
`ctffilt`

assumes that *g*=*g*_{S}, and the term *g*_{l} does not apply in the normalization of the filter coefficients *β*_{li}.

If the orders of the polynomial numerators and denominators are given as
*m* and *n*, respectively, the filter has *r* =
max(*m*,*n*) states per section. These states are located at the outputs of each *z*^{-1} delay block in the filter implementation diagram.

When you specify

`zi`

as a vector with`r`

elements,`ctffilt`

initializes the filter states by setting*ν*_{1k}=*ν*_{2k}= … =*ν*_{Lk}=`zi(k)`

for*k*= 1, 2, …,*r*.When you specify

`zi`

as a vector, matrix, or multidimensional array with`L*r`

elements in its leading dimension,`ctffilt`

initializes the filter states by setting*ν*_{lk}=`zi((l-1)*r+k)`

for*k*= 1, 2, …,*r*and*l*= 1, 2, …,*L*.

For each sample of `x`

across the first array dimension whose size is
greater than 1 or across the dimension `dim`

that you specify as
`Dimension=dim`

, the `ctffilt`

function computes
`y`

by following the filter implementation based on the transposed direct
form II structure, updates the filter states *ν*_{lk}, and repeats this operation until it finishes filtering the last sample of
`x`

.

When you specify to return

`zf`

,`ctffilt`

gathers the states*ν*_{lk}computed during the filtering of the last sample of`x`

, and stores them in`zf`

as`zf((l-1)*r+k)`

=*ν*_{lk}, for*k*= 1, 2, …,*r*and*l*= 1, 2, …,*L*.

## References

[1] Lyons, Richard
G. *Understanding Digital Signal Processing*. Upper Saddle River, NJ:
Prentice Hall, 2004.

## Extended Capabilities

## Version History

**Introduced in R2024b**