chipmuenk / pyfda

Python Filter Design Analysis Tool
http://chipmuenk.github.io/
MIT License
651 stars 93 forks source link

Editing and saving poles / zeros gives a complex impulse response h[n] #89

Open chipmuenk opened 7 years ago

chipmuenk commented 7 years ago

This is a numerical issue, a np.real_if_close() statement is needed when converting zpk -> coeffs

chipmuenk commented 7 years ago

Another part of the problem seems to be a loss of accuracy when P/Z are edited.

This requires a makeover of the coefficients and P/Z widget in such a way that e.g. only one half of symmetric coefficients resp. only P/Z with positive real part can be entered. The other half is generated automatically, ensuring fully symmetric case.

dextersLabRat commented 3 years ago

I have run into this issue with filter design with other packages like GNU Octave. I have done as you suggested, that is, to take one complex pole or zero and make its complex conjugate just by flipping the sign of the imaginary part. That way, there are no numerical issues and the time domain response as well as the filter coeffs are all real. Just commenting here to affirm that this seems like the correct solution. :+1:

chipmuenk commented 3 years ago

Thanks for the feedback! I still haven't found the drive to tackle that problem, it means a lot of rework ...