# Plotting Frequency Response Magnitude and Phase for first order all pass filter

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.

# code.m

num = [0.8,1]
den = [1;0.8]
TF = tf(num,den)
[zz,pp,kk] = tf2zp(TF)
figure(1);
bode(TF);
figure(2);
pzmap(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  • 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) – 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];