Initial commit
[pftoolbox.git] / expressions / @xhandle / xhandle.m
blob17941cf2fe4f9670019e69416aac00c06b8ff18e
1 function obj=xhandle(varargin)\r
2 % Holds a function handle.\r
3 %\r
4 % Syntax: (* = optional)\r
5 %\r
6 % obj = xhandle(expression, gradx*, gradw*);\r
7 %\r
8 % In arguments:\r
9 %\r
10 % 1. expression\r
11 %       Function handle to the expression. The in arguments are x, t, u, w.\r
12 % 2* gradx\r
13 %       Function handle to the gradient with respect to x. The in arguments are x, t, u, w.\r
14 % 2* []\r
15 %       'gradx' will be set to [], hence the EKF filter can not be used before\r
16 %       setting this property with the set command.\r
17 % 3* gradw\r
18 %       Function handle to the gradient with respect to w. The in arguments are x, t, u, w.\r
19 % 3* []\r
20 %       'gradw' will be set to [], hence the EKF filter can not be used before\r
21 %       setting this property with the set command.\r
22 %\r
23 % Out arguments:\r
24 %\r
25 % 1. obj\r
26 %       The resulting data object.\r
28 % Toolbox for nonlinear filtering.\r
29 % Copyright (C) 2005  Jakob Rosén <jakob.rosen@gmail.com>\r
30 %\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
35 %\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
40 %\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
44  \r
45 if nargin==0\r
46         % Empty constructor\r
47         expression=[];\r
48 elseif isa(varargin{1},'xhandle')\r
49         % Copy constructor\r
50         obj = varargin{1};\r
51         return;                 %Exit\r
52 else\r
53         expression=varargin{1};\r
54 end;\r
57 % Declare the arguments\r
58 gradx=[];\r
59 gradw=[];\r
61 % Fetch arguments, if they exist\r
62 if nargin>=2; gradx=varargin{2}; end;\r
63 if nargin>=3; gradw=varargin{3}; end;\r
65 obj.expression=expression;\r
66 obj.str=func2str2(expression);\r
67 obj.exprsize=zeros(1,2);\r
68 obj.gradx=gradx;\r
69 obj.gradw=gradw;\r
70 obj.xvars={};\r
71 obj.uvars={};\r
72 obj.wvars={};\r
73 obj.islinear=false;\r
74 obj.wchar='w';\r
75 obj.description='Function handle expression';\r
76 obj=class(obj,'xhandle');\r