1 function plot1d(obj,varargin);
\r
2 % Plots the data contained in the SIR object, in one dimension.
\r
3 % The particles are visualized as gauss functions.
\r
5 % Syntax: (* = optional)
\r
7 % plot1d(ekfobj, state*, colorscheme*, sigma*, gridpoints*);
\r
12 % ekf object containing the data to be plotted
\r
14 % The state x(state) will be plotted.
\r
16 % 'state' is set to 1, hence x(1) will be plotted.
\r
18 % An integer that decides what colors will be used in the figure.
\r
19 % Two colors will be picked using getcolors(colorstate)
\r
21 % 'colorscheme' is set to 2.
\r
23 % Scaling parameter of the gauss function.
\r
25 % 'sigma' is set to 10.
\r
27 % Horizontal resolution of the gauss function.
\r
29 % 'gridpoints' is set to 100.
\r
33 % Toolbox for nonlinear filtering.
\r
34 % Copyright (C) 2005 Jakob Rosén <jakob.rosen@gmail.com>
\r
36 % This program is free software; you can redistribute it and/or
\r
37 % modify it under the terms of the GNU General Public License
\r
38 % as published by the Free Software Foundation; either version 2
\r
39 % of the License, or (at your option) any later version.
\r
41 % This program is distributed in the hope that it will be useful,
\r
42 % but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
43 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
44 % GNU General Public License for more details.
\r
46 % You should have received a copy of the GNU General Public License
\r
47 % along with this program; if not, write to the Free Software
\r
48 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\r
50 % Declare the arguments
\r
56 % Fetch arguments, if they exist
\r
57 if nargin>=2; state=varargin{1}; end;
\r
58 if nargin>=3; colorscheme=varargin{2}; end;
\r
59 if nargin>=4; sigma=varargin{3}; end;
\r
60 if nargin>=5; gridpoints=varargin{4}; end;
\r
62 % If an empty argument, or no argument at all, was supplied - use its default value!
\r
64 state=1; % state default
\r
67 if isempty(colorscheme)
\r
68 colorscheme=2; % colorscheme default
\r
72 sigma=10; % sigma default
\r
75 if isempty(gridpoints)
\r
76 gridpoints=100; % gridpoints default
\r
80 color1=getcolors(colorscheme);
\r
81 x=obj.xhat_particles(state,:);
\r
85 % This improvised algorithm for window sizing seems to work ok.
\r
87 xmin=xmin-sigma*xdiff;
\r
88 xmax=xmax+sigma*xdiff;
\r
90 xg=xmin:(xmax-xmin)/gridpoints:xmax;
\r
92 m=exp(-(repmat(x',1,ng)-repmat(xg,obj.N,1)).^2)/(2*sigma^2);
\r