How to design a digital IIR to match the frequency resp of a measured analog filter
古いコメントを表示
Hello and thanks for reading!
I ask this question because I'm getting frustrated from hours of trying to work this out:
- I have measured the frequency response from an electric device (audio field) with a quite complex frequency response (several peaks/notches) plus some possible small noise/error in the measure itself.
- I need to match this magnitude response with a IIR filter. Of course it shouldn't perfectly match, but just match peaks/notches positions, so a "smoothed" version of the measure.
- I tried yulewalk and invfreqz with no success. The outcome is totally different from the freq response to match. First I needed to interpolate the measured freq resp down to 0Hz, and it was not easy (giving that the measure is logspaced). I did it manually because interpolation was not accurate, and I did it with a jump from 20Hz to 0, because the matlab commands require the frequencies to reach 0 but with a log-spaced measured frequency response you will go to zero at infinity.
- with yulewalk I had no good outcome. With invfreqz I got something vaguely similar to the freq response I need, but I found a bug: the b,a coefficients out of invfreqz are swapped, so that to obtain the right freqz plot I have to do this:
>> [b,a] = invfreqz(allon_int[0;allon(:,1)]/max(allon(:,1))*pi,1,24,wt); figure, freqz(b,a);
- Anyway with invfreqz I'm trying to mingle with the weighting vector wt, the order of the IIR, and even the iterations of the algorithm but I get most of the times totally wrong magnitude responses and the warning: Warning: Matrix is close to singular or badly scaled.
Any help would be appreciated. For examples: how to improve the frequency response to be matched? Should I make it smoother? Or create a vector with only the peaks and notches to be matched (and another one with their frequencies)?
Thanks for reading, any advice will be great!
採用された回答
その他の回答 (5 件)
Alfredo
2011 年 9 月 6 日
Wayne King
2011 年 9 月 6 日
0 投票
Hi Alfredo, You say you have measured the frequency response. Have you measured the complex-valued response (magnitude and phase), or do you just have the magnitude?
By your use of invfreqz() I would assume that you have the complex-valued response, but then you reference the magnitude response in your post, so I'm not sure what you have to begin with?
Wayne
Wayne King
2011 年 9 月 7 日
0 投票
Hi Alfredo, invfreqz expects the complex-valued frequency response. If you only have the magnitude then a suggestion close to Honglei's is fdesign.arbmag. If you have the DSP System Toolbox, then Honglei's demo suggestion is a great place to start. You can still use fdesign.arbmag if you do not have DSP but have the Signal Processing Toolbox. However, you will not have access to all the specifications. See the reference page for fdesign.arbmag for details.
カテゴリ
ヘルプ センター および File Exchange で Analog Filters についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!