I'm fitting IIR filters to a complex transfer function with Matlab's invfreqz.m. My fitting results are very good, but when I come very close to the Nyquist frequency the phase response runs to 0 and I also get deviations in the magnitude response. I did some research but couldn't find anything regarding that phenomenon. Can anybody point me in the right direction, for which keywords I have to search in order to find something on that topic and how I can try to optimize the fitting near the Nyquist frequency?

  • 1
    $\begingroup$ The phase of a discrete-time system always equals $0$ or $\pi$ at Nyquist; there's nothing you can do about it. Furthermore, the magnitude response must be symmetrical around Nyquist, i.e. $|H(\pi-\omega)|=|H(\pi+\omega)|$. So you'll always get larger approximation errors close to Nyquist than at other frequencies. In practice you have to choose the sampling frequency such that your frequency range of interest stops slightly below Nyquist. Have a look at this answer to see an approximation of an analog filter by a digital filter. $\endgroup$ – Matt L. Apr 12 '16 at 14:35
  • $\begingroup$ Could you provide a plot of the desired response and its discrete-time approximation? $\endgroup$ – Matt L. Apr 12 '16 at 14:35
  • $\begingroup$ thank you for your answer, i just couldnt come up with the reason for the phase response being equal to 0 at Nyquist, but when i read your comment it came to my mind instantly. Are there certain ways to keep the magnitude response as stable as possible as near to Nyquist as possible or respectively approximate as close as possible near to Nyquist? $\endgroup$ – user967493 Apr 12 '16 at 14:56
  • $\begingroup$ Unfortunatelly i have to use a curve fitting algorithm to derive my filter $\endgroup$ – user967493 Apr 12 '16 at 15:05
  • $\begingroup$ If the discrete-time filter doesn't have a zero at Nyquist, the derivative of its magnitude must be zero (because of the symmetry with respect to Nyquist); this is why the magnitude approximation at Nyquist can be worse than below Nyquist. Let me know your desired response and the chosen filter order and I can try to design a filter for you to have a comparison. BTW, have you checked if the filter returned by invfreqz is stable? $\endgroup$ – Matt L. Apr 12 '16 at 16:05

You can't get a good fit very near the Nyquist frequency (or near DC) because information is lost due to the imaginary components around that frequency being of (almost) opposite phase and thus (nearly) cancelling out. Thus, there will be ambiguity errors due to trying to fit any curve to lost information.

If possible, you can try to gather more information near (but not at) the Nyquist frequency by sampling for a longer time span or at a higher sample rate. This will move the measurement point slightly farther from where there is complete cancellation of the imaginary component.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.