please i need help in this matlab homework
A digital filter is described by the difference equation
y[n]=-0.9y[n-1]+0.18y[n-2]+x[n]+x[n-1]
a. Plot the magnitude and phase of the frequency response of this filter. Compare the results with the freqz command of MATLAB.
b. Generate 200 samples of the signal x [n]= sin(pi*n/ 3) 5cos(pi*n) and process through the filter. Compare the steady state response portion of the output to . How are the amplitudes and phases of the two sinusoids affected by the filter?
I solve it ,but i don't know how to get magnitude and phase..
My code is
n = -10:100;
a = [1 0.9 -0.18]; % left hand side of difference equation
b = [1 1 0]; % right hand side of difference equation
h=filter(b,a,n); %find h from difference equation
plot(n,h)
h=filter(b,a,n)
n = -10:100;
a = [1 0.9 -0.18]; % left hand side of difference equation
b = [1 1 0]; % right hand side of difference equation
h=filter(b,a,n); %find h from difference equation
plot(n,h)
h=freqz(b,a,n)
A digital filter is described by the difference equation
y[n]=-0.9y[n-1]+0.18y[n-2]+x[n]+x[n-1]
a. Plot the magnitude and phase of the frequency response of this filter. Compare the results with the freqz command of MATLAB.
b. Generate 200 samples of the signal x [n]= sin(pi*n/ 3) 5cos(pi*n) and process through the filter. Compare the steady state response portion of the output to . How are the amplitudes and phases of the two sinusoids affected by the filter?
I solve it ,but i don't know how to get magnitude and phase..
My code is
n = -10:100;
a = [1 0.9 -0.18]; % left hand side of difference equation
b = [1 1 0]; % right hand side of difference equation
h=filter(b,a,n); %find h from difference equation
plot(n,h)
h=filter(b,a,n)
n = -10:100;
a = [1 0.9 -0.18]; % left hand side of difference equation
b = [1 1 0]; % right hand side of difference equation
h=filter(b,a,n); %find h from difference equation
plot(n,h)
h=freqz(b,a,n)