# tf2cl

Transfer function to coupled allpass lattice

## Syntax

```[k1,k2] = tf2cl(b,a) [k1,k2] = tf2cl(b,a) [k1,k2,beta] = tf2cl(b,a) ```

## Description

`[k1,k2] = tf2cl(b,a)` where `b` is a real, symmetric vector of numerator coefficients and `a` is a real vector of denominator coefficients, corresponding to a stable digital filter, will perform the coupled allpass decomposition

`$H\left(z\right)=\frac{B\left(z\right)}{A\left(z\right)}=\left(\frac{1}{2}\right)\left[H1\left(z\right)+H2\left(z\right)\right]$`

of a stable IIR filter H(z) and convert the allpass transfer functions H1(z) and H2(z) to a coupled lattice allpass structure with coefficients given in vectors `k1` and `k2`.

`[k1,k2] = tf2cl(b,a)` where `b` is a real, antisymmetric vector of numerator coefficients and `a` is a real vector of denominator coefficients, corresponding to a stable digital filter, performs the coupled allpass decomposition

`$H\left(z\right)=\frac{B\left(z\right)}{A\left(z\right)}=\left(\frac{1}{2}\right)\left[H1\left(z\right)-H2\left(z\right)\right]$`

of a stable IIR filter H(z) and converts the allpass transfer functions H1(z) and H2(z) to a coupled lattice allpass structure with coefficients given in vectors `k1` and `k2`.

In some cases, the decomposition is not possible with real H1(z) and H2(z). In those cases, a generalized coupled allpass decomposition may be possible, using the syntax described below.

`[k1,k2,beta] = tf2cl(b,a)` performs the generalized allpass decomposition of a stable IIR filter H(z) and converts the complex allpass transfer functions H1(z) and H2(z) to corresponding lattice allpass filters

`$H\left(z\right)=\frac{B\left(z\right)}{A\left(z\right)}=\left(\frac{1}{2}\right)\left[\overline{\beta }\cdot H1\left(z\right)+\beta \cdot H2\left(z\right)\right]$`

where `beta` is a complex scalar of magnitude equal to 1.

Note

Coupled allpass decomposition is not always possible. Nevertheless, Butterworth, Chebyshev, and Elliptic IIR filters, among others, can be factored in this manner. For details, refer to Signal Processing Toolbox™ User's Guide.

## Examples

```[b,a]=cheby1(9,.5,.4); [k1,k2]=tf2cl(b,a); % Get the reflection coeffs. for the lattices. [num1,den1]=latc2tf(k1,'allpass'); % Convert each allpass lattice [num2,den2]=latc2tf(k2,'allpass'); % back to transfer function. num = 0.5*conv(num1,den2)+0.5*conv(num2,den1); den = conv(den1,den2); % Reconstruct numerator and denonimator. MaxDiff=max([max(b-num),max(a-den)]); % Compare original and reconstructed % numerator and denominators.```

## Extended Capabilities 