1 function [obj, xpred, xpred_p]=tupdate(obj,varargin)
\r
2 % Time update method for the SIR particle filter
\r
4 % Syntax: (* = optional)
\r
6 % [sirobj, xpred, xpred_particles] = tupdate(sirobj, u*, xhat_particles*, t*);
\r
11 % SIR filter object that will be used for the time update.
\r
13 % A scalar or column vector u(t) containing the deterministic data for the particular step.
\r
15 % No u(t) will be used in the calculations.
\r
17 % A matrix representing the last particle swarm used for estimation of x
\r
19 % xhat_particles will be set to ekfobj.xhat_particles.
\r
21 % The time of the actual filtering step. Ts will be set to this value
\r
23 % t will be set to ekfobj.t, and also Ts will be set to this value
\r
28 % SIR object containg the result of the filter operation.
\r
30 % One-step prediction of x
\r
31 % This can also be accessed from the object using the sirobj.xpred property
\r
32 % 3. xpred_particles
\r
33 % The particle swarm used to calculate xpred.
\r
34 % This can also be accessed from the object using the sirobj.xpred_particles property
\r
36 % Toolbox for nonlinear filtering.
\r
37 % Copyright (C) 2005 Jakob Rosén <jakob.rosen@gmail.com>
\r
39 % This program is free software; you can redistribute it and/or
\r
40 % modify it under the terms of the GNU General Public License
\r
41 % as published by the Free Software Foundation; either version 2
\r
42 % of the License, or (at your option) any later version.
\r
44 % This program is distributed in the hope that it will be useful,
\r
45 % but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
46 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
47 % GNU General Public License for more details.
\r
49 % You should have received a copy of the GNU General Public License
\r
50 % along with this program; if not, write to the Free Software
\r
51 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\r
53 % Since ue defaults to [], we don't have to go through the long procedure with it
\r
54 if nargin>=2; ue=varargin{1}; else; ue=[]; end;
\r
56 % Declare the arguments
\r
60 % Fetch arguments, if they exist
\r
61 if nargin>=3; xhat_p=varargin{2}; end;
\r
62 if nargin>=4; t=varargin{3}; end;
\r
64 % If an empty argument, or no argument at all, was supplied - use its default value!
\r
66 xhat_p=obj.xhat_particles;
\r
74 xpred_p=f_general(obj.model,xhat_p,t,ue); % Time update
\r
75 xpred=mean(xpred_p,2); % Save predicted data
\r
77 Ts=t; % One samplepoint used.
\r
78 t=t+get(model,'T'); % Update time
\r
80 % Store relevant variables in the object
\r
82 obj.xhat_particles=xhat_p;
\r
83 obj.xpred_particles=xpred_p;
\r