# Should I pass Kalman Filter absolute or offset-from-mean sensor values?

I'm using Kalman filters to segment the loudness of an acoustic signal from surrounding noise. The problem I've encountered is that muffled or faulty microphones measuring 'silence' (-70dB, -69dB, -71dB, ...) have low variance and so the Kalman filter relies on them as being more stable, "pulling down" the true value.

To solve this, I had the idea to pass in the offset-from-mean of all the signals, which would increase the variance of the "dead sensors" and I could add back the mean to the state estimate delta. But then it occurred to me that maybe the Kalman filter is already doing this by minimising "least squares error"?

A secondary problem I have is dynamically adding or removing sensors without losing my covariance matrix. Currently when sensors leave, I keep the same matrix, but I set it's observation variance R_ij = Infinity, which seems to work. However, I would love to know how to re-arrange my matrix values when adding or removing additional sensors.

• Could you show the math for your filter? Specifically, are you maintaining a state for each sensor, or are you combining sensor inputs into a measurement? – TimWescott Dec 15 '20 at 17:12

As mentioned in another answer, the variance of the measurement noise is a property of the model which is baked in to the Kalman filter.

I think you're running into a different problem, which is that your model is different from reality. It sounds like you're modeling the system assuming that all the microphones are 'live'. If that's the case, then the filter won't take a dead microphone as something to be ignored -- it'll take a dead microphone as a live microphone that's 'hearing' utterly valid silence.

Note that Kalman filters can do some apparently absurd things in the presence of a model mismatch. Because they assume Gaussian distributions for everything, and because the PDF of a Gaussian drops off so profoundly as you stray from the mean, they really don't do a good job handling real-world processes that have low kurtosis, nor do they handle model mismatch very well.

You need to modify your filter, or sanitize its input. It's probably best to modify the filter by augmenting it with an external "dead microphone" detector (and make sure you get it right -- you're basically automatically throwing out outliers, and there's known problems with doing that too enthusiastically). Or, make sure a human goes through the data and makes sure the microphones are live.

You are doing something other than a Kálmán filter here. You write "muffled or faulty microphones measuring 'silence' (-70dB, -69dB, -71dB, ...) have low variance and so the Kalman filter relies on them as being more stable" but the variance is not a measured size but part of the model. And the model does not accommodate sensors going dead a priori (though of course if you have outside knowledge of a sensor being dead you can use it for changing the model, possibly using something like a hidden Markov model for detecting its time of death).

So all your questions are outside of the parameters of a Kálmán filter and instead concern ad-hoc modifications of it or dunamic adaptations of its model. Since you give no information whatsoever about what kind of modifications or adaptations you are working with, your question cannot be answered.

• Your answer prompted me to check and I see that indeed the posterior error covariance is calculated at every step as I - (KalmanGain * ObservationModel) * PriorErrorCovariance, which is only a function of the prior error covariance and observation noise covariance (given), and not of the measurements (although it could be measured). What do you mean by adaptations? I am merely trying to track the true envelope of an acoustic signal in the presence of noise (assume time-delay is compensated for). – Petrus Theron Sep 27 '18 at 9:42