⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 program_4_1.m

📁 这是国外一本经典教材附带的程序
💻 M
字号:
% Program 4_1
% Generate the filter coefficients
h1 = ones(1,5)/5; h2 = ones(1,14)/14;
w = 0:pi/255:pi;
%  Compute the frequency responses
H1 = freqz(h1, 1, w);
H2 = freqz(h2, 1, w);
%  Compute and plot the magnitude responses
m1 = abs(H1); m2 = abs(H2);
plot(w/pi,m1,'r-',w/pi,m2,'b--');
ylabel('Magnitude'); xlabel('\omega/\pi');
legend('r-','M=5','b--','M=14');
pause
%  Compute and plot the phase responses
ph1 = angle(H1)*180/pi; ph2 = angle(H2)*180/pi;
plot(w/pi,ph1,w/pi,ph2);
ylabel('Phase, degrees');xlabel('\omega/\pi');
legend('r-','M=5','b--','M=14');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -