Biquad coefficients using Magnitude (or Phase) Invariance Mapping Method
- KVRist
- 91 posts since 24 Dec, 2015 from Bristol, UK
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).
-
- KVRian
- Topic Starter
- 832 posts since 21 Feb, 2006 from FI
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:
Is there a known theory behind this phenomenon or is there something in MIM code I could try fix?
While testing the LPF at various sample rates I noticed that increasing fs worses the magnitude response of low order MIM filter:
Is there a known theory behind this phenomenon or is there something in MIM code I could try fix?
- KVRist
- 91 posts since 24 Dec, 2015 from Bristol, UK
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.
-
- KVRian
- Topic Starter
- 832 posts since 21 Feb, 2006 from FI
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).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 to 20Hz situation looks this:
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.
-
- KVRian
- Topic Starter
- 832 posts since 21 Feb, 2006 from FI
Probably there's not much one can do for above phenomenon.
MIM/PIM paper mentions that
Fortunately MIM method works correctly for my purposes. It's results quite accurate magnitude response against the analog model as this plot shows:
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:
-
- KVRian
- 1153 posts since 11 Aug, 2004 from Breuillet, France
Hello juha_p !
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
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.Never mind ... found the reason for issue and now plots are OK.
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
Last edited by Ivan_C on Wed Jul 27, 2016 6:23 pm, edited 2 times in total.
-
- KVRian
- Topic Starter
- 832 posts since 21 Feb, 2006 from FI
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.
-
- KVRian
- 1153 posts since 11 Aug, 2004 from Breuillet, France
Nevermind, the MATLAB function is good, I had just forgotten to divide all the coefficients in the table with the first denominator coefficient
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
I love spending hours "debugging scientific articles"
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
I love spending hours "debugging scientific articles"