berndporr / iir1

DSP IIR realtime filter library written in C++
http://berndporr.github.io/iir1/
MIT License
637 stars 140 forks source link

Setting filter initial state #61

Closed ftapajos closed 1 year ago

ftapajos commented 1 year ago

Is there a possibility of setting the filter initial state? The trouble is I need to set a low pass chebychev in order to calculate the offset of a signal, but I need it to have a fast response only after it is reset and the traditional "slow" response during normal operation

berndporr commented 1 year ago

There is no easy way of setting it to an initial state. An IIR filter remembers its past and needs to settle on its input signal it receives. So even if you send it 10,000 samples DC in there to fake settling then the actual signal will then start abruptly and will cause again the filter to settle. If you know you are going to use a filter with different parameters then better you create more than one filter and then switch their outputs