Home > src > ghrts_smooth.m

# ghrts_smooth

## PURPOSE GHRTS_SMOOTH - Additive form Gauss-Hermite Rauch-Tung-Striebel smoother

## SYNOPSIS function [M,P,D] = ghrts_smooth(M,P,f,Q,f_param,p,same_p)

## DESCRIPTION ``` GHRTS_SMOOTH - Additive form Gauss-Hermite Rauch-Tung-Striebel smoother

Syntax:
[M,P,D] = GHRTS_SMOOTH(M,P,f,Q,[f_param,p,same_p])

In:
M - NxK matrix of K mean estimates from Gauss-Hermite Kalman filter
P - NxNxK matrix of K state covariances from Gauss-Hermite filter
f - Dynamic model function as a matrix A defining
linear function f(x) = A*x, inline function,
function handle or name of function in
form a(x,param)                   (optional, default eye())
Q - NxN process noise covariance matrix or NxNxK matrix
of K state process noise covariance matrices for each step.
f_param - Parameters of f(.). Parameters should be a single cell array,
vector or a matrix containing the same parameters for each
step, or if different parameters are used on each step they
must be a cell array of the format { param_1, param_2, ...},
where param_x contains the parameters for step x as a cell
array, a vector or a matrix.   (optional, default empty)
p - Degree on approximation (number of quadrature points)
same_p - If set to '1' uses the same parameters on every time step
(optional, default 1)

Out:
M - Smoothed state mean sequence
P - Smoothed state covariance sequence
D - Smoother gain sequence

Description:
Gauss-Hermite Rauch-Tung-Striebel smoother algorithm. Calculate
"smoothed" sequence from given Kalman filter output sequence by
conditioning all steps to all measurements.

Example:
m = m0;
P = P0;
MM = zeros(size(m,1),size(Y,2));
PP = zeros(size(m,1),size(m,1),size(Y,2));
for k=1:size(Y,2)
[m,P] = ghkf_predict(m,P,f,Q);
[m,P] = ghkf_update(m,P,Y(:,k),h,R);
MM(:,k) = m;
PP(:,:,k) = P;
end
[SM,SP] = ghrts_smooth(MM,PP,f,Q);