Skip to content
Snippets Groups Projects
Commit 55740f37 authored by Fredrik Bagge Carlson's avatar Fredrik Bagge Carlson
Browse files

Updates to kalman

parent 32b22926
No related branches found
No related tags found
1 merge request!1Dev
...@@ -44,11 +44,10 @@ function forward_kalman(y,A,R1,R2, P0) ...@@ -44,11 +44,10 @@ function forward_kalman(y,A,R1,R2, P0)
end end
"""A kalman parameter smoother""" """A kalman parameter smoother"""
function kalman_smoother(y, R1, R2) function kalman_smoother(y, A, R1, R2, P0)
na = size(R1,1) na = size(R1,1)
N = length(y) N = length(y)
P0 = 100*R1;
xkk,xk,Pkk,Pk = forward_kalman(y,A,R1,R2, P0) xkk,xk,Pkk,Pk = forward_kalman(y,A,R1,R2, P0)
xkn = zeros(xkk) xkn = zeros(xkk)
Pkn = zeros(P) Pkn = zeros(P)
...@@ -61,8 +60,6 @@ function kalman_smoother(y, R1, R2) ...@@ -61,8 +60,6 @@ function kalman_smoother(y, R1, R2)
Pkn[:,:,i] = Pkk[:,:,i] + C*(Pkn[:,:,i+1] - Pk[:,:,i+1])*C' Pkn[:,:,i] = Pkk[:,:,i] + C*(Pkn[:,:,i+1] - Pk[:,:,i+1])*C'
end end
newplot(xkk'); title("x_{k|k}") return xkn, Pkn
newplot(xkn'); title("x_{k|n}")
return xkn
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment