comparison toolboxes/FullBNT-1.0.7/Kalman/smooth_update.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:cc4b1211e677
1 function [xsmooth, Vsmooth, VVsmooth_future] = smooth_update(xsmooth_future, Vsmooth_future, ...
2 xfilt, Vfilt, Vfilt_future, VVfilt_future, A, Q, B, u)
3 % One step of the backwards RTS smoothing equations.
4 % function [xsmooth, Vsmooth, VVsmooth_future] = smooth_update(xsmooth_future, Vsmooth_future, ...
5 % xfilt, Vfilt, Vfilt_future, VVfilt_future, A, B, u)
6 %
7 % INPUTS:
8 % xsmooth_future = E[X_t+1|T]
9 % Vsmooth_future = Cov[X_t+1|T]
10 % xfilt = E[X_t|t]
11 % Vfilt = Cov[X_t|t]
12 % Vfilt_future = Cov[X_t+1|t+1]
13 % VVfilt_future = Cov[X_t+1,X_t|t+1]
14 % A = system matrix for time t+1
15 % Q = system covariance for time t+1
16 % B = input matrix for time t+1 (or [] if none)
17 % u = input vector for time t+1 (or [] if none)
18 %
19 % OUTPUTS:
20 % xsmooth = E[X_t|T]
21 % Vsmooth = Cov[X_t|T]
22 % VVsmooth_future = Cov[X_t+1,X_t|T]
23
24 %xpred = E[X(t+1) | t]
25 if isempty(B)
26 xpred = A*xfilt;
27 else
28 xpred = A*xfilt + B*u;
29 end
30 Vpred = A*Vfilt*A' + Q; % Vpred = Cov[X(t+1) | t]
31 J = Vfilt * A' * inv(Vpred); % smoother gain matrix
32 xsmooth = xfilt + J*(xsmooth_future - xpred);
33 Vsmooth = Vfilt + J*(Vsmooth_future - Vpred)*J';
34 VVsmooth_future = VVfilt_future + (Vsmooth_future - Vfilt_future)*inv(Vfilt_future)*VVfilt_future;
35
36