KerMor  0.9
Model order reduction for nonlinear dynamical systems and nonlinear approximation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RandomModelEstimatorAnalyzer.m
Go to the documentation of this file.
1 namespace demos{
2 
3 
4 /* (Autoinserted by mtoc++)
5  * This source code has been filtered by the mtoc++ executable,
6  * which generates code that can be processed by the doxygen documentation tool.
7  *
8  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
9  * Except for the comments, the function bodies of your M-file functions are untouched.
10  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
11  * attached source files that are highly readable by humans.
12  *
13  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
14  * the correct locations in the source code browser.
15  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
16  */
17 
19  :public EstimatorAnalyzer {
33  public:
34 
35  Dims = 500;
44  NumCenters = 10;
71  public:
72 
73 
75 
76  /* % Model settings */
77  fm = models.BaseFullModel;
78  fm.Name= " Estimator Demo Model ";
79 
80  fm.T= 1;
81  fm.dt= .025;
82 
83  fm.Approx= [];
84  fm.Sampler= [];
85 
86  /* this.ODESolver = solvers.MLWrapper(@ode45); */
87  fm.ODESolver= solvers.ExplEuler(fm.dt);
88  /* fm.ODESolver = solvers.Heun(fm.dt); */
89 
90  /* % Core function */
91  cf = dscomponents.ParamTimeKernelCoreFun;
92  kexp = cf.Expansion;
93  kexp.TimeKernel= kernels.NoKernel;
94  kexp.ParamKernel= kernels.NoKernel;
95  kexp.Centers.ti= [];
96  kexp.Centers.mui= [];
97 
98  /* % System settings */
99  sys = models.BaseFirstOrderSystem(fm);
100  sys.MaxTimestep= fm.dt;
101  sys.f= cf;
102 
103  fm.System= sys;
104  this.Model= fm;
105 
106  if nargin == 1
107  this.Dims= dims;
108  else
109  this.newCoeffs;
110  end
111  }
123  function setup() {
124  k = kernels.GaussKernel(15);
125  k.G= 1;
126  this.Model.System.f.Expansion.Kernel= k;
127  x0 = rand(this.Dims,1);
128  if this.PositiveExpansion
129  base = linspace(0, 40, this.NumCenters);
130  this.Model.System.x0= dscomponents.ConstInitialValue(x0);
131  else
132  base = linspace(-20, 20, this.NumCenters);
133  this.Model.System.x0= dscomponents.ConstInitialValue(x0-.5);
134  end
135  this.Model.System.f.Expansion.Centers.xi= repmat(base,this.Dims,1);
136 
137  if this.UniformExpansion
138  V = ones(this.Dims,1)*sqrt(1/this.Dims);
139  s = spacereduction.ManualReduction(V,V);
140  else
141  s = spacereduction.PODReducer;
142  s.Mode= " abs ";
143  s.Value= 1;
144  s.UseSVDS= false;
145  end
146  this.Model.SpaceReducer= s;
147 
148  /* % Generation */
149  this.setModel(this.Model);
150  }
151 
152 
153  function newCoeffs() {
154  offset = .5;
155  if this.PositiveExpansion
156  offset = 0;
157  end
158  /* Create coefficients */
159  if this.UniformExpansion
160  ai = (rand(1,this.NumCenters)-offset);
161  this.Model.System.f.Expansion.Ma= repmat(ai,this.Dims,1);
162  else
163  this.Model.System.f.Expansion.Ma= (rand(this.Dims,this.NumCenters)-offset);
164  end
165  this.setup;
166  }
174 #if 0 //mtoc++: 'set.Dims'
175 function Dims(value) {
176  this.Dims= value;
177  this.newCoeffs;
178  /* this.setup; %#ok */
179  }
180 
181 #endif
182 
183 
184 
185 #if 0 //mtoc++: 'set.NumCenters'
186 function NumCenters(value) {
187  this.NumCenters= value;
188  this.newCoeffs;
189  /* this.setup; %#ok */
190  }
191 
192 #endif
193 
194 
195 
196 #if 0 //mtoc++: 'set.PositiveExpansion'
197 function PositiveExpansion(value) {
198  this.PositiveExpansion= value;
199  /* this.setup; %#ok */
200  this.newCoeffs;
201  }
202 
203 #endif
204 
205 
206 
207 #if 0 //mtoc++: 'set.UniformExpansion'
208 function UniformExpansion(value) {
209  this.UniformExpansion= value;
210  this.newCoeffs;
211  /* this.setup; %#ok */
212  }
213 
214 #endif
215 
216 
234 };
235 }
236 
237 
238 
Demo class for the error estimators. Creates a random model using a kernel expansion that can be conf...
function setModel(models.BaseFullModel model)
Sets the model to use for the estimator demo.
models.BaseFirstOrderSystem System
The actual dynamical system used in the model.
Definition: BaseModel.m:102
function newCoeffs()
Function coefficients.
UniformExpansion
Uniform expansion or comp-wise separate?
NumCenters
Number of centers used in kernel expansion.
models.BaseFullModel Model
The used model.
dscomponents.AInitialValue x0
Function handle to initial state evaluation.
Analysis class for the error estimators.
spacereduction.BaseSpaceReducer SpaceReducer
The reduction algorithm for subspaces.
dscomponents.ACoreFun f
The core f function from the dynamical system.
PositiveExpansion
Strictly positive kernel expansion?
RandomModelEstimatorAnalyzer(dims)
Creates a new estimator demo.