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
ICIAMExperiment.m
Go to the documentation of this file.
1 namespace models{
2 namespace iciam2011{
3 
4 
5 /* (Autoinserted by mtoc++)
6  * This source code has been filtered by the mtoc++ executable,
7  * which generates code that can be processed by the doxygen documentation tool.
8  *
9  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
10  * Except for the comments, the function bodies of your M-file functions are untouched.
11  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
12  * attached source files that are highly readable by humans.
13  *
14  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
15  * the correct locations in the source code browser.
16  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
17  */
18 
20  :public models.BaseFullModel {
29  public: /* ( setObservable ) */
30 
31  dim;
44  public: /* ( setObservable ) */
45 
46 
48  this.registerProps(" dim ");
49 
50  this.dim= dims;
51 
52  this.Sampler= [];/* sampling.GridSampler; */
53 
54 
55  /* This class implements a fake Approx subclass to allow access
56  * to the this.Ma property for the error estimator. */
57  this.Approx= [];
58 
59  /* % System settings */
60  this.System= models.iciam2011.ICIAMSystem(this);
61 
62  this.T= 20;
63  this.dt= 0.05;
64 
65  /* s = solvers.MLWrapper(@ode45); */
66  s = solvers.ExplEuler;
67  s.MaxStep= [];
68  /* s = solvers.Heun; */
69  this.ODESolver= s;
70 
71  this.System.addParam(" mu1 ", .5, " Range ", [0 1], " Desired ", 4);
72  this.System.addParam(" mu2 ", 1);
73  this.Sampler= sampling.GridSampler;
74 
75  e1 = [ones(dims,1) zeros(dims,1)];
76  e2 = [zeros(dims,1) ones(dims,1)];
77 
78  x0 = dscomponents.AffineInitialValue;
79  x0.addMatrix(" mu(2) ", ones(dims,1));
80  /* x0.addMatrix('sum(mu)', e1); */
81  this.System.x0= x0;
82 
83  fexp = this.System.f.Expansion;
84  fexp.Ma= repmat(-exp(-fexp.Centers.xi(1,:)/15),dims,1);
85 
86  /* this.System.Inputs{1} = @(t)[.04*sin(t/3); exp(-abs(10-t/2))]; */
87  this.System.Inputs[1] = @(t)[.04*sin(t/3);.5*exp(-(12-t).^2)];
88  /* m.System.Inputs{2} = @(t)exp(-abs(10-t/2)); % Gutes Beispiel!
89  * m.System.Inputs{3} = @(t).5*exp(-(12-t).^2); % Sehr interessante dynamik
90  * m.System.Inputs{4} = @(t)(t>10)*.1; % okay, aber nicht so spannend */
91  B = dscomponents.AffLinInputConv;
92  B.addMatrix(" mu(1) ", e1);
93  B.addMatrix(" 1-mu(1) ", e2);
94  /* B.addMatrix('-mu(2)', e2); */
95  this.System.B= B;
96 
97  this.TrainingInputs= 1;
98 
99  this.System.C= dscomponents.LinearOutputConv(ones(1,dims)/dims);
100 
101  V = ones(dims,1)/sqrt(dims);
102  s = spacereduction.ManualReduction(V,V);
103  /* s = spacereduction.PODReducer;
104  * s.Value = 3;
105  * s.Mode = 'abs';
106  * s.UseSVDS = dims > 10000;
107  * this.SpaceReducer = s; */
108 
109  s = spacereduction.RotationDecorator(s);
110  s.Dims= 100;
111  s.Degree= 0.05;
112  this.SpaceReducer= s;
113 
114  e = error.IterationCompLemmaEstimator;
115  e.UseTimeDiscreteC= true;
116  this.ErrorEstimator= e;
117  }
118 
119 
120  public: /* ( Static ) */ /* ( setObservable ) */
121 
122 
123  static function [d , r , m ] = CreatePlots(dim) {
124 
125  m = ICIAMExperiment(dim);
126  s = m.SpaceReducer;
127 
128  d = EstimatorAnalyzer;
129  d.EstimatorIterations= [1 2 5];
130  d.EstimatorVersions= [1 1 0 0 1 0 0 1 1];
131  d.SingleFigures= true;
132 
133  d.setModel(m);
134  r = d.ReducedModel;
135 
136  for mu1 = [0 1]
137  d.start([mu1; 1], 1);
138 
139  /* 1 = full, 7 = LSLE TD */
140  md = d.ModelData(end);
141  absmax = 30*abs(md.ErrT(7)-md.ErrT(1));
142  relmax = 30*abs(md.RelErrT(7)-md.RelErrT(1));
143 
144  f = d.Figures[1];
145  a = gca(f);
146  axis(a,[0 m.T md.MinErr*.9 min(1e4,absmax)]);
147  set(legend(a)," Location "," NorthEast ");
148  Utils.saveFigure(f,sprintf(" ICIAM_mu1_%d_deg%f_errors ", mu1, s.Degree)," fig ");
149  title(a,);
150  Utils.saveFigure(f,sprintf(" ICIAM_mu1_%d_deg%f_errors ", mu1, s.Degree));
151 
152  f = d.Figures[2]; a = gca(f);
153  axis(a,[0 m.T md.MinRelErr*.9 min(1,relmax)]);
154  set(legend(a)," Location "," NorthEast ");
155  Utils.saveFigure(f,sprintf(" ICIAM_mu1_%d_deg%f_relerr ", mu1, s.Degree)," fig ");
156  title(a,);
157  Utils.saveFigure(f,sprintf(" ICIAM_mu1_%d_deg%f_relerr ", mu1, s.Degree));
158 
159  f = d.Figures[3]; a = gca(f);
160  Utils.saveFigure(f,sprintf(" ICIAM_mu1_%d_deg%f_ctimes ", mu1, s.Degree)," fig ");
161  title(a,);
162  Utils.saveFigure(f,sprintf(" ICIAM_mu1_%d_deg%f_ctimes ", mu1, s.Degree));
163 
164  end
165 
166  PlotParamSweep(r,[1; 1],1,1,-.1:.05:1.1);
167  Utils.saveFigure(gcf," mu1_sweep "," png ");
168 
169  d.createStatsTables;
170  }
171 
172 
173 
174 };
175 }
176 }
177 
178 
179 
Collection of generally useful functions.
Definition: Utils.m:17
Numerical experiments class for Paper ICIAM.
error.BaseEstimator ErrorEstimator
The associated error estimator for this model.
The base class for any KerMor detailed model.
Definition: BaseFullModel.m:18
double dt
The desired time-stepsize for simulations.
Definition: BaseModel.m:291
integer TrainingInputs
The indices of inputs to use for training data generation. Uses the DefaultInput if not set (and Defa...
sampling.BaseSampler Sampler
The sampling strategy the Model uses.
models.BaseFirstOrderSystem System
The actual dynamical system used in the model.
Definition: BaseModel.m:102
dscomponents.AInputConv B
The input conversion.
function registerProps(varargin)
Call this method at any class that defines DPCM observed properties.
Definition: DPCMObject.m:125
rowvec EstimatorIterations
How many estimator iterations should be performed?
dscomponents.AInitialValue x0
Function handle to initial state evaluation.
solvers.BaseSolver ODESolver
The solver to use for the ODE. Must be an instance of any solvers.BaseSolver subclass.
Definition: BaseModel.m:315
static function saveFigure(fig, filename, ext)
Opens a matlab save dialog and saves the given figure to the file selected.
Definition: Utils.m:324
Inputs
The system's possible input functions. A cell array of function handles, each taking a time argument ...
approx.BaseApprox Approx
The approximation method for the CoreFunction.
double T
The final timestep up to which to simulate.
Definition: BaseModel.m:271
Analysis class for the error estimators.
spacereduction.BaseSpaceReducer SpaceReducer
The reduction algorithm for subspaces.
dscomponents.LinearOutputConv C
The output conversion Defaults to an LinearOutputConv instance using a 1-matrix, which just forwards ...
dscomponents.ACoreFun f
The core f function from the dynamical system.
static function [ d , r , m ] = CreatePlots(dim)
dim
The system's dimension.
function ModelParam p = addParam(char name, default, varargin)
Adds a parameter with the given values to the parameter collection of the current dynamical system...