annotate 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
rev   line source
Daniel@0 1 function [xsmooth, Vsmooth, VVsmooth_future] = smooth_update(xsmooth_future, Vsmooth_future, ...
Daniel@0 2 xfilt, Vfilt, Vfilt_future, VVfilt_future, A, Q, B, u)
Daniel@0 3 % One step of the backwards RTS smoothing equations.
Daniel@0 4 % function [xsmooth, Vsmooth, VVsmooth_future] = smooth_update(xsmooth_future, Vsmooth_future, ...
Daniel@0 5 % xfilt, Vfilt, Vfilt_future, VVfilt_future, A, B, u)
Daniel@0 6 %
Daniel@0 7 % INPUTS:
Daniel@0 8 % xsmooth_future = E[X_t+1|T]
Daniel@0 9 % Vsmooth_future = Cov[X_t+1|T]
Daniel@0 10 % xfilt = E[X_t|t]
Daniel@0 11 % Vfilt = Cov[X_t|t]
Daniel@0 12 % Vfilt_future = Cov[X_t+1|t+1]
Daniel@0 13 % VVfilt_future = Cov[X_t+1,X_t|t+1]
Daniel@0 14 % A = system matrix for time t+1
Daniel@0 15 % Q = system covariance for time t+1
Daniel@0 16 % B = input matrix for time t+1 (or [] if none)
Daniel@0 17 % u = input vector for time t+1 (or [] if none)
Daniel@0 18 %
Daniel@0 19 % OUTPUTS:
Daniel@0 20 % xsmooth = E[X_t|T]
Daniel@0 21 % Vsmooth = Cov[X_t|T]
Daniel@0 22 % VVsmooth_future = Cov[X_t+1,X_t|T]
Daniel@0 23
Daniel@0 24 %xpred = E[X(t+1) | t]
Daniel@0 25 if isempty(B)
Daniel@0 26 xpred = A*xfilt;
Daniel@0 27 else
Daniel@0 28 xpred = A*xfilt + B*u;
Daniel@0 29 end
Daniel@0 30 Vpred = A*Vfilt*A' + Q; % Vpred = Cov[X(t+1) | t]
Daniel@0 31 J = Vfilt * A' * inv(Vpred); % smoother gain matrix
Daniel@0 32 xsmooth = xfilt + J*(xsmooth_future - xpred);
Daniel@0 33 Vsmooth = Vfilt + J*(Vsmooth_future - Vpred)*J';
Daniel@0 34 VVsmooth_future = VVfilt_future + (Vsmooth_future - Vfilt_future)*inv(Vfilt_future)*VVfilt_future;
Daniel@0 35
Daniel@0 36