Commit 55740f37 authored by Fredrik Bagge Carlson's avatar Fredrik Bagge Carlson
Browse files

Updates to kalman

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