开发者

Matlab firpm fails for large AFR data arrays

开发者 https://www.devze.com 2023-04-13 08:50 出处:网络
Here is a quick & dirty code for trying to create a high precision equalizer: bandPoints = 355; for n = 1:bandPoints

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 param开发者_开发问答eter 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号