Biquad coefficients using Magnitude (or Phase) Invariance Mapping Method

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

Magnitude of HP and BP are both zero when the frequency is zero. This is where I previously ran into problems with cepstral methods. The way I got round it previously was using the value of -1e-48 for log(0) (or something that equated to a very small decibel gain) and making sure the FFT window was large enough so that the FFT didn't get too upset (maybe there is a proper way to do it).

Post

Thanks, I'll try your suggestion.

While testing the LPF at various sample rates I noticed that increasing fs worses the magnitude response of low order MIM filter:

Image

Is there a known theory behind this phenomenon or is there something in MIM code I could try fix?

Post

If you increase your sampling rate by a factor of X, it is the same as reducing your corner frequency by the same amount (in the digital domain). So try doing that instead to see if you get the same results, otherwise it may well be a bug.

Post

keithwood wrote:If you increase your sampling rate by a factor of X, it is the same as reducing your corner frequency by the same amount (in the digital domain). So try doing that instead to see if you get the same results, otherwise it may well be a bug.
When fc is set lower the same magnitude error happens for low order MIM filter. Fc is needed only for to build the analog model (which looks being OK) of the filter (code given in one of previous posts).

When Fc is set to 20Hz situation looks this:
Image
All MIM filters are little or more off but if the filter order is set to say 8 then it follows exactly the analog model upto fs/2.

Post

Probably there's not much one can do for above phenomenon.
MIM/PIM paper mentions that
in some cases a higher order filter is needed because of periodic property H(e^jw) and also because of the cusp in the magnitude observed around ±π. Similarly a higher order digital filter may be required when the sampling time is decreased.

Fortunately MIM method works correctly for my purposes. It's results quite accurate magnitude response against the analog model as this plot shows:

Image

Post

Hello juha_p !
Never mind ... found the reason for issue and now plots are OK.
Would you mind sharing the corrections you did on the original MATLAB code for the function c2dn ? Some parts are suspicious and I have not been able so far to apply the corrections necessary to get the results given in the article.

For example, thanks to the Tustin method result of the first calculus, I have been able to find out that the very first D(s) is (5s + 2) and not (0.5s + 2) or 0.5(s + 4) as written in the article and the appendix A. But I can't get the MIM/PIM results right, and my plots are wrong...

Thanks in advance :wink:
Last edited by Ivan_C on Wed Jul 27, 2016 6:23 pm, edited 2 times in total.

Post

I did not get the results given in paper either (I left these behind and started to look if the MIM/PIM is suitable for common filters). Actually I did not correct the c2dn() function.
Last edited by juha_p on Wed Jul 27, 2016 6:25 pm, edited 2 times in total.

Post

Nevermind, the MATLAB function is good, I had just forgotten to divide all the coefficients in the table with the first denominator coefficient :dog:

However, the first and the second D(s) given as examples are wrong, that's insane ! The correct ones are (5s + 2) and (s + 10) / (s^2 + 4.1s + 0.4). With that, got thanks to the Tustin result in the tables, all the MIM calculations become right. The third one (PIM) was already right fortunately.

And Ts must be 1 everywhere indeed :wink:

I love spending hours "debugging scientific articles" :lol:

Post

Thanks for debugging :tu: ... it looks all right now.

Post Reply

Return to “DSP and Plugin Development”