Digital High Pass Filter in MATLAB

y[n] = x[n] - a*y[n − 1]
Y[z]=X[z]-a*Y[z]*z^-1
Y[z]+a*Y[z]*z^-1=X[z]
Y[z]*[1+a*z^-1]=X[z]
Y[z]/X[z]=1/[1+a*z^-1]
H[z]=1/[1+a*z^-1]=z/z+a
Pole
[1+a*z^-1]=0
a*z^-1=-1
z^-1=-1/a
z=-a


% Code:-

w=-pi:0.01:pi;
num=[1];
den=[1 0.5];
h=freqz(num,den,w);
subplot(2,1,1);
plot(w,abs(h));
ylabel('Magnitude');
subplot(2,1,2);
plot(w,angle(h));
ylabel('Phase');

No comments