Matlab filter responce and magnitude of filter question.
I have been working on this HW and I am not sure if I didsomething wrong. Here is my code.
%y[n]=x[n]+x[n-1]-x[n-4]-x[n-5];
%y[n]=y[n-1]-.9*y[n-2]+x[n]+x[n-1]
clear
clc
[x,fs] = audioread('toto.wav');
x = x(:,1);
dt = 1/fs;
t = 0:dt:(length(x)*dt)-dt;
plot(t,x); xlabel('Seconds'); ylabel('Amplitude');
num=[1 1 -.9];
den=[1 1 0 0 -1 -1];
sys=tf(num,den);
k=filter(num,den,x);
subplot(3,1,1);
plot(t,k);
title('filter response');
w=0:0.001:pi;
[h,om]=freqz(num,den,w)
m=20*log10 (abs(h))
an=angle(h)
subplot(3,1,2)
plot(om/pi,m)
title('mag spectrum of filter')
xlabel('freq')
ylabel('mag in db')
subplot(3,1,3)
plot(om/pi,an)
title('phase spectrum of filter')
xlabel('freq')
So I was playing around and when I use the 2nd equation at thetop like in this code my filter response or the magnitude don'tchange. Why is that? Did I do something wrong? It doesn't evenchange if I change the values of the den either.