1 function v=fgradx_general(obj,x,t,u,varargin)
\r
2 % Calculates: grad_x[f(x,t) + gu(x,t)*u(t) + gw(x,t)*w(t)]
\r
4 % Syntax: (* = optional)
\r
6 % grad_x = fgradx_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
21 % w(t) is drawn from model.w
\r
26 % The result of the operation: the gradient with respect to x.
\r
28 % Toolbox for nonlinear filtering.
\r
29 % Copyright (C) 2005 Jakob Rosén <jakob.rosen@gmail.com>
\r
31 % This program is free software; you can redistribute it and/or
\r
32 % modify it under the terms of the GNU General Public License
\r
33 % as published by the Free Software Foundation; either version 2
\r
34 % of the License, or (at your option) any later version.
\r
36 % This program is distributed in the hope that it will be useful,
\r
37 % but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
38 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
39 % GNU General Public License for more details.
\r
41 % You should have received a copy of the GNU General Public License
\r
42 % along with this program; if not, write to the Free Software
\r
43 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\r
45 % Handle the process noise
\r
46 w=[]; % Default: draw noise from object
\r
48 w=varargin{1}; % w was supplied as an argument
\r
51 % No w was given as an argument. Use model.w to draw random data
\r
52 % if size(x,2)>1, we are dealing with a particle swarm and must draw a matrix
\r
53 w=random(obj.w, t, 1, size(x,2));
\r
56 % We assume that w=0 and no noise is going to be drawn.
\r
57 % However, the zero matrix needs to have the same length as x,
\r
58 % because we're dealing with a particle swarm.
\r
59 w=zeros(get(obj.w,'n'), size(x,2));
\r
60 end % If size(x,2)==1, use the supplied w value (probably 0)
\r
62 % Evaluate grad_x(f(x,t,u,w))
\r
63 v=gradx(obj.f,x,t,u,w);
\r