Having trouble plotting the frequency response characteristics for first order all pass filter. The Magnitude is expected to be constant across entire freq and Phase is expected to be only decreasing (with jump from -pi to pi). I don't see either of this happening, provided plot from octave.

$H_{ap}(z) = {z^{-1} - a^* \over 1 - az^{-1}}\tag{1}$

Above is condition to enable all pass filter.


num = [0.8,1]  
den = [1;0.8]   
TF = tf(num,den)   
[zz,pp,kk] = tf2zp(TF)  

Octave output:

Octave output:

Transfer function 'TF' from input 'u1' to output ...

      0.8 s + 1
 y1:  ---------
       s + 0.8

Continuous-time model.
zz = -1.2500
pp = -0.80000
kk =  0.80000

enter image description here

enter image description here

  • $\begingroup$ It looks like you are mixing continuous and and discrete time concepts. I don't have access to tf() and bode() but tf() seems to be returning something in the s-plane , not the z-plane. In Matlab you would do directly [z,p,k] = tf2zp(num,den) (using row vectors for both num and den) $\endgroup$ – Hilmar Jun 19 '20 at 11:06

As pointed out by Hilmar in a comment, you should remain in the discrete domain. This is most easily done by using the functions freqz() and zplane():

b = [.8,1]; a = [1,.8];
[H,w] = freqz(b,a,2048);
subplot(2,1,1), plot(w/pi,abs(H));
subplot(2,1,2), plot(w/pi,angle(H));
figure, zplane(b,a)

Note that for a first-order all-pass filter it's also quite straightforward to come up with analytical solutions for the magnitude and phase of the frequency response.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.