%% Convert Coupled Allpass to Transfer Function Form
% 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')

% Copyright 2012 The MathWorks, Inc.