%% Design Allpass Matching Filter
% Design the allpass mapping filter changing the real lowpass filter with the cutoff frequency Wo at 0.5 into a complex bandpass filter with band edges Wt1 and Wt2 precisely defined at 0.2 and 0.4, respectively. Calculate the frequency response of the mapping filter in the full range.

Wo = 0.5;
Wt = [0.2 0.4];
[AllpassNum,AllpassDen] = allpasslp2bpc(Wo,Wt);
[h,f] = freqz(AllpassNum,AllpassDen,'whole');
plot(f/pi,abs(angle(h))/pi,Wt,Wo,'ro');
title('Mapping Function Wo(Wt)');
xlabel('New Frequency, Wt'); 
ylabel('Old Frequency, Wo');

% Copyright 2011 The MathWorks, Inc.