这是尝试创建高精度均衡器的快速而肮脏的代码:
bandPoints = 355;
for n = 1:bandPoints
x = (n / (bandPoints + 2));
f = (x*x)*(22000-20)+20; % 20...22000
freqs(n) = f;
niqfreqs(n) = f/22050.0;
amps(n) = 0;
end
amps(bandPoints+1) = 0; % firpm needs even numbers
niqfreqs(bandPoints+1) = 1; % firpm needs even numbers
% set some point to have a high amplitude
amps(200) = 1;
fircfs = firpm(101,niqfreqs,amps);
[h,w] = freqz(fircfs,1,512);
plot(w/pi,abs(h));
legend('firpm Design')
但它给了我
Warning:
*** FAILURE TO CONVERGE ***
Probable cause is machine rounding error.
所有 FIR 系数均为 0。
如果我将 n 参数从 101 降低到 91,firpm
则可以正常工作,但频率响应远非理想。考虑到我想为支持多达 12288 个抽头的硬件 DSP FIR 模块计算 FIR 系数,如何让 Matlab 计算所需的系数?能够做到这firpm
一点,还是我需要在 Matlab 和以后的应用程序 C++ 代码中使用另一种方法(逆 FFT)?