Created
August 23, 2023 17:58
-
-
Save mschauer/2845fcf62570fac67a03f3a9b7fc7365 to your computer and use it in GitHub Desktop.
Fancy mean with Kalman filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Kalman | |
using Kalman.GaussianDistributions | |
using Statistics, LinearAlgebra | |
# prior for time 0 | |
x0 = 0.0 | |
P0 = floatmax(x0) | |
# observation operator | |
H = 1.0 | |
# (mock) data | |
ys = [2, 3, 2, 2, 1, 5, 4, 4, 4, 4] | |
# Kalman filter | |
R = var(ys) | |
p = Gaussian(x0, P0) | |
for i in 1:length(ys) | |
global p | |
p, yres, _ = Kalman.correct(Kalman.JosephForm(), p, (Gaussian(ys[i], R), H)) | |
end | |
@show p |
Author
mschauer
commented
Aug 23, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment