# tf2ca

Transfer function to coupled allpass

## Syntax

[d1,d2] = tf2ca(b,a)
[d1,d2] = tf2ca(b,a)
[d1,d2,beta] = tf2ca(b,a)

## Description

[d1,d2] = tf2ca(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, returns real vectors d1 and d2 containing the denominator coefficients of the allpass filters H1(z) and H2(z) such that

$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]$

representing a coupled allpass decomposition.

[d1,d2] = tf2ca(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, returns real vectors d1 and d2 containing the denominator coefficients of the allpass filters H1(z) and H2(z) such that

$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]$

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, as described in the following syntax.

[d1,d2,beta] = tf2ca(b,a) returns complex vectors d1 and d2 containing the denominator coefficients of the allpass filters H1(z) and H2(z), and a complex scalar beta, satisfying |beta| = 1, such that

$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]$

representing the generalized allpass decomposition.

In the above equations, H1(z) and H2(z) are real or complex allpass IIR filters given by

$H1\left(z\right)=\frac{fliplr\left(\overline{\left(D1\left(z\right)\right)}\right)}{D1\left(z\right)},H2\left(1\right)\left(z\right)=\frac{fliplr\left(\overline{\left(D2\left(1\right)\left(z\right)}\right)\right)}{D2\left(1\right)\left(z\right)}$

where D1(z) and D2(z) are polynomials whose coefficients are given by d1 and d2.

### Note

A 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);
[d1,d2]=tf2ca(b,a); 	% TF2CA returns denominators of the allpass.
num = 0.5*conv(fliplr(d1),d2)+0.5*conv(fliplr(d2),d1);
den = conv(d1,d2); 	% Reconstruct numerator and denonimator.
MaxDiff=max([max(b-num),max(a-den)]); % Compare original and reconstructed
% numerator and denominators.

Watch now