I am very new to Kalman filter. I am doing a project using one sensor the track the sensor's position. I developed 2 methods to solve the position, one in better accuracy and one is less accurate.

I would like to know that can I use Kalman filter to fuse the 2 position-solving algorithms to achieve a better performance? I know Kalman filter is often used in sensor fusion(multiple sensors). I don't know is it also work on fusing algorithms(single sensor).

  • $\begingroup$ Hello, I posted an answer and I edited it a lot because I'm not sure to understand your question very well. Do you want to know how to implement Kalman for sensor fusion or do you want to if it might work on your problem? If you are in the second case please be more explicit about your input data and your two algorithms. $\endgroup$
    – NokiYola
    Commented Feb 21, 2023 at 9:56
  • $\begingroup$ Thanks for your contribution. It is the second case. I would like to know if kalman filter work on my problem. To be specific, I have one magnetic sensor. I have 2 methods to solve the real-time sensor's position (x,y,z) . I just want to know if I run 2 methods simultaneously, then I will get 2 sets of sensor's position ( one in higher accuracy, and the other in lower accuracy). Can i use kalman filter to fuse the 2 sets of data and get a better performance than just using1 method alone? $\endgroup$
    – Ko Chunwai
    Commented Feb 21, 2023 at 10:37
  • $\begingroup$ Does your sensor have Gaussian noise? Are your algorithms linear? if not, do their output show Gaussian-ish noise?(you need Gaussian noise to perform the vanilla Kalman filter) Do you even know their variance-covariance matrices, which in my knowledge would be a prerequisite for sensor fusion? My personal belief is that without more exogenous output Kalman filter will not outperform your best algorithm but maybe I'm wrong. You should try it in a simple simulation and come back to tell your results. I'm actually curious about the answer. $\endgroup$
    – NokiYola
    Commented Feb 21, 2023 at 10:54
  • $\begingroup$ I have read some papers about using kalman filter on the magnetic sensor localization. I think it is not linear. And people actually is using unscented kalman filter. However, i am just wondering can i do the fusion on One single sensor with 2 algorithms. I haven't completed the second algorithm, so i cannot tell their variance-covariance. $\endgroup$
    – Ko Chunwai
    Commented Feb 22, 2023 at 7:32
  • $\begingroup$ If you have two data points and two associated variance-covariances matrices at each step, you will be able to perform Kalman filtering. If you don't have ridiculous outliers, it is likely that your Kalman filter will not derail into nothingness. Now will the Kalman yield better results than your best algorithm... I have no clue. It would feel weird because you don't incorporate new information but why not? This tutorial shows that one can estimate a position and its derivative with the stupidest of models for instance. $\endgroup$
    – NokiYola
    Commented Feb 22, 2023 at 7:42

1 Answer 1


I guess you could consider one algorithm to output the prediction and its covariance matrix, one algorithm to output the measurement (in the Kalman filter sense) and its covariance matrix.

To be more accurate, in the formalism found here one algorithm gives you $\hat{X}_{k|k-1}$ and $\hat{P}_{k|k-1}$ and the other gives you $z_k$ and $R_k$.

Then the update would look something like that : $$X_{k|k} = \hat{X}_{k|k-1}+\hat{P}_{k|k-1}(\hat{P}_{k|k-1}+R_k)^{-1}(z_k-\hat{X}_{k|k})$$

That's how I'd go at least. Off course here this works if all your algorithm output noises are Gaussian. This happens if your manipulations from your data are linear and your data has Gaussian noise (if you do something linear to a Gaussian vector, it remains a Gaussian vector).

Although I'm no Kalman expert, I'm not sure you absolutely have to have a Gaussian vector for the noise of the prediction. But if your data has considerable outliers the vanilla Kalman filter will diverge.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.