DC Removal | Intuitive Filter Design | MATLAB code

We have placed pole near z=1 , but not at z=1 , so that the pole will increase the magnitude near z=1 but at z=1 , due to zero , the magnitude will be equal to 0.
Code for removing DC:-

t=0:1:20;
x=sin(t)+3;
subplot(2,1,1);
stem(t,x);
hold on;
plot(t,x);
num=[1 -1];
den=[1 -0.95];
e=filter(num,den,x);
subplot(2,1,2);
stem(e);
hold on;
plot(e);

Code for getting magnitude and phase response:-

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

No comments