When using a Kalman filter, one of the variables that must be defined is a matrix representing the covariance of the observation noise. In the implementations I have seen, this matrix is defined once, and that same matrix is then used throughout the algorithm, each time an update step is taken.
However, in my particular problem, I am able to get a state-dependent covariance of the observation noise. This is because instead of using the raw observation, I actually use the observation to predict the state (using some machine learning), and this prediction itself comes with a known uncertainty. This is effectively equivalent to treating the state prediction as my "observation", and the uncertainty from this prediction as the covariance of the observation noise.
So, in the update step of the Kalman filter, could I use this state-dependent noise covariance, such that each update would use a different covariance matrix? Or does this invalidate all the maths, and I really do need to use a fixed covariance matrix for the entire algorithm?