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
BaseCoreFun.m
Go to the documentation of this file.
1 namespace models{
2 namespace pcd{
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 
39  public: /* ( Constant ) */
40 
41  static const .double ActivationTransitionTime = 10;
56  static const .double MaxActivationTime = 400;
79  public: /* ( Dependent ) */
80 
100  private:
101 
102  gaussian;
103 
104  fAFT = 1;
105 
106 
107  public:
108 
109  BaseCoreFun(dynsys) {
110  this = this@dscomponents.ACompEvalCoreFun(dynsys);
111  this.TimeDependent= true;
112 
113  this.ActivationFunType= 1;
114  }
115 
116 
117  function copy = clone(copy) {
118  copy = clone@dscomponents.ACompEvalCoreFun(this, copy);
119  /* Sets gaussian etc */
120  copy.ActivationFunType= this.ActivationFunType;
121  }
133  function evaluateCoreFun() {
134  error(" dont call me (direct overload of evaluate for efficiency ");
135  }
136 
137 
139  if nargin < 3
140  pm = PlotManager;
141  pm.LeaveOpen= true;
142  if nargin < 2
143  mu = this.System.Model.getRandomParam;
144 
145  end
146  end
147 
148  h = pm.nextPlot(" activation_fun "," External input activation function "," time "," factor ");
149  t = linspace(0,min(this.System.Model.T,this.MaxActivationTime*1.2),2000);
150  plot(h,t,this.activationFun(t/this.System.Model.tau,mu));
151 
152  if nargin < 3
153  pm.done;
154  end
155  }
156 
157 
158 
159 #if 0 //mtoc++: 'set.ActivationFunType'
160 function ActivationFunType(value) {
161  if value == 1
162  /* \gamma=28 is such that we have K(0,27)~<.4 (27=150/tau) */
163  k = kernels.GaussKernel(28.206364723698);
164  else
165  k = kernels.GaussKernel;
166  k.setGammaForDistance(this.ActivationTransitionTime/this.System.Model.tau,.001);
167  end
168  this.gaussian= k;
169  this.fAFT= value;
170  }
171 
172 #endif
173 
180 #if 0 //mtoc++: 'get.ActivationFunType'
181 function value = ActivationFunType() {
182  value = this.fAFT;
183  }
184 
185 #endif
186 
187 
188  protected:
189 
190  function f = activationFun(double t,colvec<double> mu) {
191  g = this.gaussian;
192  if this.ActivationFunType == 1
193  f = (g.evaluateScalar(t-27)-.4).*(t<=54)/.6;
194  else
195  tau = this.System.Model.tau;
196  ts = this.ActivationTransitionTime/tau;
197  te = ts+(mu(3,:)*(this.MaxActivationTime-2*this.ActivationTransitionTime))/tau;
198  f = (g.evaluateScalar(t-ts)-.001).*(t<=ts)/.999 ...
199  + (t>ts).*(t<=te) ...
200  + (g.evaluateScalar(t-te)-.001).*(t>te).*(t<=te+ts)/.999;
201  end
202  }
203 
204 
205  protected: /* ( Static ) */
206 
207  static function obj = loadobj(obj,from) {
208  if nargin == 2
209  if isfield(from," System ")
210  obj.System= from.System;
211  end
212  /* Sets gaussian etc */
213  if isfield(from," fAFT ")
214  AFT = from.fAFT;
215  else
216  AFT = 1;
217  end
218  obj.ActivationFunType= AFT;
219  obj = loadobj@dscomponents.ACompEvalCoreFun(obj, from);
220  else
221  obj = loadobj@dscomponents.ACompEvalCoreFun(obj);
222  end
223  }
224 
225 
231 };
232 }
233 }
234 
function evaluateCoreFun()
Definition: BaseCoreFun.m:133
logical TimeDependent
Flag that indicates if the ACoreFun is (truly) time-dependent.
Definition: ACoreFun.m:84
Model
The Model this System is attached to.
static const .double ActivationTransitionTime
The time in seconds needed before the activation function reaches its maximum value and decays back t...
Definition: BaseCoreFun.m:41
An integer value.
PlotManager: Small class that allows the same plots generated by some script to be either organized a...
Definition: PlotManager.m:17
static function obj = loadobj(obj, from)
Definition: BaseCoreFun.m:207
logical LeaveOpen
Flag indicating if the plots should be left open once the PlotManager is deleted (as variable) ...
Definition: PlotManager.m:213
static const .double MaxActivationTime
The maximum time in seconds that spans the support of the piecewise activation function. It is composed of gaussian-shaped increase/decrease ends and a constant one in between. For the default settings, we would have a maximum duration of 500s-2*30s=440s for the activation rate of level one. [s].
Definition: BaseCoreFun.m:56
models.BaseFirstOrderSystem System
The system associated with the current ACoreFun.
Definition: ACoreFun.m:193
function plotActivationFun(colvec< double > mu, pm)
Definition: BaseCoreFun.m:138
colvec< double > mu
The current model parameter mu for evaluations. Will not be persisted as only valid for runtime durin...
Definition: ACoreFun.m:208
ACompEvalCoreFun: A normal CoreFun which supports single-component evaluation.
function copy = clone(copy)
Call superclass method.
Definition: BaseCoreFun.m:117
integer ActivationFunType
Type of the activation function.
Definition: BaseCoreFun.m:81
function f = activationFun(double t,colvec< double > mu)
Definition: BaseCoreFun.m:190