Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/Kalman/smooth_update.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
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 |