1 function v=fgradw_general(obj,x,t,u,varargin)
\r
2 % Calculates: grad_w[f(x,t) + gu(x,t)*u(t) + gw(x,t)*w(t)]
\r
4 % Syntax: (* = optional)
\r
6 % grad_w = fgradw_general(model, x, t, u, w*);
\r
13 % Column vector or scalar containing x
\r
15 % Scalar containing the time of the operation.
\r
17 % Column vector or scalar containing deterministic data for this particular step.
\r
19 % Column vector or scalar containing w(t) for this particular step.
\r
20 % Redundant argument for this model, because w(t) is elimiated by the differentiation.
\r
25 % The result of the operation: the gradient with respect to w.
\r
27 % Toolbox for nonlinear filtering.
\r
28 % Copyright (C) 2005 Jakob Rosén <jakob.rosen@gmail.com>
\r
30 % This program is free software; you can redistribute it and/or
\r
31 % modify it under the terms of the GNU General Public License
\r
32 % as published by the Free Software Foundation; either version 2
\r
33 % of the License, or (at your option) any later version.
\r
35 % This program is distributed in the hope that it will be useful,
\r
36 % but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
37 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
38 % GNU General Public License for more details.
\r
40 % You should have received a copy of the GNU General Public License
\r
41 % along with this program; if not, write to the Free Software
\r
42 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\r
44 % Handle the process noise
\r
45 w=[]; % Default: draw noise from object
\r
47 w=varargin{1}; % w was supplied as an argument
\r
50 % No w was given as an argument. Use model.w to draw random data
\r
51 % if size(x,2)>1, we are dealing with a particle swarm and must draw a matrix
\r
52 w=random(obj.w, t, 1, size(x,2));
\r
55 % We assume that w=0 and no noise is going to be drawn.
\r
56 % However, the zero matrix needs to have the same length as x,
\r
57 % because we're dealing with a particle swarm.
\r
58 w=zeros(get(obj.w,'n'), size(x,2));
\r
59 end % If size(x,2)==1, use the supplied w value (probably 0)
\r
61 v=gradw(obj.f,x,t,u,w);
\r