修DSP時有學到system的frequency response,想要以matlab tool來畫增強對frequency response的感覺,以下以moving average system來當作例子:
matlab code(frequency response)如下:
omega = -2*pi:pi/400:2*pi;
H5 = ((1/5)*(1-exp(-1i*omega*5))./(1-exp(-1i*omega)));
plot(omega,abs(H5)), title('frequency response');
結果的圖如下
matlab code(phase response)如下:
omega = -2*pi:pi/400:2*pi;
H5 = ((1/5)*(1-exp(-1i*omega*5))./(1-exp(-1i*omega)));
plot(omega,angle(H5)), title('Phase plot');
結果的圖如下