Matlab firpm 对于大型 AFR 数据阵列失败

发布于 2024-12-10 09:02:10 字数 978 浏览 2 评论 0 原文

这是一个快速&尝试创建高精度均衡器的肮脏代码:

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 工作时没有错误,但频率响应远未达到预期。考虑到我想计算硬件DSP FIR模块的FIR系数,该模块最多支持12288个抽头,我怎样才能让Matlab计算所需的系数? firpm 是否能够执行此操作,或者我是否需要在 Matlab 以及稍后的应用程序 C++ 代码中使用另一种方法(逆 FFT)?

Here is a quick & dirty code for trying to create a high precision equalizer:

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')

but it gives me

Warning:
  *** FAILURE TO CONVERGE ***
  Probable cause is machine rounding error.

and all FIR coefficients are 0.

If I lower the n parameter from 101 to 91, firpm works without errors, but the frequency response is far from desired. And taking into account, that I want to calculate FIR coefficients for a hardware DSP FIR module, which supports up to 12288 taps, how can I make Matlab calculate the needed coefficients? Is firpm capable of doing this or do I need to use another approach (inverse FFT) in both Matlab and later in my application C++ code?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

物价感观 2024-12-17 09:02:10

哦,看来MP算法确实无法处理这个问题,所以我需要一些其他解决方案:

http://www.eetimes.com/design/embedded/4212775/Designing-very-high-order-FIR-filters-with-zero-stuffing

我想,我会有然后继续使用逆FFT。

Oh, it seems MP algorithm really cannot handle this, so I need some other solution:

http://www.eetimes.com/design/embedded/4212775/Designing-very-high-order-FIR-filters-with-zero-stuffing

I guess, I'll have to stick with inverse FFT then.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文