mathnet / mathnet-filtering

Math.NET Filtering (formerly Neodym)
http://filtering.mathdotnet.com
Other
235 stars 80 forks source link

Butterworth Filter #19

Open fissssssh opened 3 years ago

fissssssh commented 3 years ago

I use MathNet.Filtering.Butterworth.IirCoefficients.LowPass(double passbandFreq, double stopbandFreq, double passbandRipple, double stopbandAttenuation) generated a coefficients, but I dont konw how to use the coefficients to get a instance of iir filter

HegrJan commented 3 years ago

In deed, there's no straightforward way how to apply the Butterworth IIR coefficients (numerators, denominators) to the OnlineIirFilter's constructor in the API. Could you please also extend the Butterworth coefficients calculator to accept given (order, sampling rate, frequency/ies)? E.g. there's no direct way how to compute coefficients for the bandpass filter of known order, sampling rate and low/high cut frequencies. As far as I can understand all the necessary code is there, but some functions are private and some minor refactoring would be needed. @Fylax, could you please have a look on that?

Fylax commented 3 years ago

@HegrJan Sure thing, I'll try to check it out ASAP (hopefully, this weekend I'll be able to check on it)

megawattfs commented 1 year ago

I'm in the same boat: Chose a Butterworth filter order & cutoff frequency when I was quickly experimenting with data in scipy, but can't bring it into my .NET app. Are there any examples of how to define a filter by order and actually apply it to the data?

Fylax commented 1 year ago

@megawattfs hello. I just remembered I promised long ago I would have took a look on it. In the meantime I changed my job, and I forgot. I'm sorry for that. If it can be of any help, the function implementation is based on octave one, i.e., Matlab/octave documentation is a great starting point

Jumbalaya commented 1 year ago

Hi @megawattfs

You can find an online filter implementation in my fork: https://github.com/StefanoPietrosanti/mathnet-filtering/tree/ButterworthOnlineIirFilter

I submitted a pull request 10 months ago but the maintainers may have abandoned this project.

(this is my personal account, the other is the professional one, but you can contact me on either)

megawattfs commented 1 year ago

@Jumbalaya Thanks for your response! I'll try and use this. By the way, it looks like the reason your pull request hasn't been merged is because of a build failure.

Jumbalaya commented 1 year ago

The build failure is due to an outdated appveyor configuration, which I tried to fix... with another ignored pull request.

On Fri, 12 Aug 2022, 22:01 Margaret Schrayer, @.***> wrote:

@Jumbalaya https://github.com/Jumbalaya Thanks for your response! I'll try and use this. By the way, it looks like the reason your pull request hasn't been merged is because of a build failure.

— Reply to this email directly, view it on GitHub https://github.com/mathnet/mathnet-filtering/issues/19#issuecomment-1213517162, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGADR5SRXX2SN35MGP5RTDVY23TNANCNFSM4PS5UOVA . You are receiving this because you were mentioned.Message ID: @.***>