I have a 1st order lowpass IIR filter of the form
$ H(z) = \frac{b_{0} +b_{1} z^{-1}}{1+a_{1} z^{-1}} $
implemented using the direct method my code looks something like this
state2=state1;
state1=signal x-state2*a1;
output=b0*state1+b1*state2;
that has a cutoff frequency X that has been calculated from the fundamental frequency of signal x. Now given that the fundamental frequency of signal x changes and it takes me time "t" to detect this new frequency, is there any way I can reduce the transient response that I see from resetting the states to zero and changing the a and b coefficiets (by logging the states, old filter output or other data over time "t" and using this to calculate the new states rather than resetting them to 0) ? Or would someone be able to provide me with a signpost as to what topics i should be googling?