# ca2tf

Convert coupled allpass filter to transfer function form

## Syntax

```[b,a]=ca2tf(d1,d2) [b,a]=ca2tf(d1,d2,beta) [b,a,bp]=ca2tf(d1,d2) [b,a,bp]=ca2tf(d1,d2,beta) ```

## Description

`[b,a]=ca2tf(d1,d2)` returns the vector of coefficients `b` and the vector of coefficients `a` corresponding to the numerator and the denominator of the transfer function

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

`d1` and `d2` are real vectors corresponding to the denominators of the allpass filters `H1(z)` and `H2(z)`.

`[b,a]=ca2tf(d1,d2,beta)` where `d1`, `d2` and `beta` are complex, returns the vector of coefficients `b` and the vector of coefficients `a` corresponding to the numerator and the denominator of the transfer function

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

`[b,a,bp]=ca2tf(d1,d2)`, where `d1` and `d2` are real, returns the vector `bp` of real coefficients corresponding to the numerator of the power complementary filter G(z)

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

`[b,a,bp]=ca2tf(d1,d2,beta)`, where `d1`, `d2` and `beta` are complex, returns the vector of coefficients `bp` of real or complex coefficients that correspond to the numerator of the power complementary filter G(z)

`$G\left(z\right)=Bp\left(z\right)/A\left(z\right)=\frac{1}{{2}_{j}}\left[-\left(\overline{\beta }\right)\cdot H1\left(z\right)+\beta \cdot H2\left(z\right)\right]$`

## Examples

Create a filter, convert the filter to coupled allpass form, and convert the result back to the original structure (create the power complementary filter as well).

 `[b,a]=cheby1(10,.5,.4);` `[d1,d2,beta]=tf2ca(b,a);` `% tf2ca returns the denominators of the allpasses` `[num,den,numpc]=ca2tf(d1, d2,beta);` ```% Reconstruct the original filter plus the power complementary one``` `[h,w,s]=freqz(num,den);` `hpc` = `freqz(numpc,den);` `s.plot` = `'mag';` `s.yunits` = `'sq';` `freqzplot([h hpc],w,s);` ```% Plot the mag response of the original filter and the power complementary one```

## Examples

collapse all

Create a filter, convert the filter to coupled allpass form, and convert the result back to the original structure (create the power complementary filter as well).

```[b,a]=cheby1(10,.5,.4); [d1,d2,beta]=tf2ca(b,a);```

`tf2ca` returns the denominators of the allpass filters

`[num,den,numpc]=ca2tf(d1, d2,beta);`

Plot the magnitude response of the original filter and the power complementary one.

```fvtool(num,den,numpc,den,'Analysis','magnitude','MagnitudeDisplay',... 'Magnitude Squared')``` 