GNU Octave 中 IIR Butterworth 的频率响应误差

信息处理 频率 八度
2022-02-07 22:50:18

我想知道为什么 GNU Octave 的以下代码在频域中的幅度为 2。例如,在图 1 中。(抱歉,我显然不允许发布图像!)可以看出带通巴特沃斯滤波器的-3dB点在150和300Hz,而不是设计要求的300和600Hz。我真的看不出我做错了吗?

%Start from nothing!
clear;

% Set the sampling frequency used by our digital filtering system:
fs=8000;

% Start designing a butterworth filter, passband. (In Hz)
pass_lo = 300;
pass_hi = 600;

% The order of the filter
order = 4;

% Determine the low and high frequencies of the passband as fractions of the
% sampling rate:
flo = pass_lo/fs;
fhi = pass_hi/fs;

% Use the butterworth filter design function to get the coefficients for a
% bandpass filter with the settings above:
[b,a] = butter(order, [flo fhi]);

% Determine the frequency response of the filter design above. Get the output
% in frequency rather than rad/s. Use 512 plot points.
[H,f] = freqz(b, a, 512, fs);

% Plot the result so that we can see if it is correct:
figure(1);
plot(f, 20*log10(abs(H)));
xlabel('Frequency (Hz)');
ylabel('Magnitude (dB)');
1个回答

不了解 GNU,但在 Matlab 中,频率参数是相对于奈奎斯特频率 (fs/2) 而不是采样率本身 (fs) 指定的。这使得相对截止频率为 1(而不是 0.5)的最大合法论点。您的频率参数应该是 [flo fhi]/fs*2。