prog7b3.m
来自「这是几种滤波器的MATLAB的M文件源码」· M 代码 · 共 18 行
M
18 行
%
% Program name - prog7b3.m, p446
% m-file for calculating optimal FIR filter coefficients and
% plotting frequency response
%
Fs=10000; % Sampling frequency
N=41; % Filter length
WT=[10 3 10]; % Weights of the deviations in the bands
Hd=[0 0 1 1 0 0]; % Desired magnitude response in the bands
F=[0 0.1 0.2 0.3 0.4 1]; % Band edge frequencies
b = remez(N-1, F, Hd, WT); % Compute the filter coefficients
[H, f] = freqz(b, 1, 512, Fs); % Compute the frequency response
mag = 20*log10(abs(H)); % of filter and plot it
plot(f, mag), grid on
xlabel('Frequency (Hz)')
ylabel('Magnitude (dB)')
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?