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
ConstantUntil.m
Go to the documentation of this file.
1 namespace general{
2 namespace functions{
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 
30  private:
31 
32  stoptime;
33 
34  rampperc;
35 
36 
37  public:
38 
39  ConstantUntil(time,percent) {
40  if nargin < 2
41  percent = .005;
42  if nargin < 1
43  time = 1;
44  end
45  end
46  this.stoptime= time;
47  this.rampperc= percent;
48  }
49 
50 
51  function [fhandle , df ] = getFunction() {
52  st = this.stoptime;
53  p = this.rampperc;
54  rampstart = st*(1-p);
55  /* 1 for t < rampstart */
56  fhandle = @(t)(t < rampstart) + ...
57  (t >= rampstart & t < st).*(1-(t-st*(1-p))/(st*p));
58  /* 1 to 0 over ramptime, zero after */
59  df = @(t)0;
60  }
61 
62 
63  function str = getConfigStr() {
64  str = sprintf(" Endtime: %g, Ramp percent: %g ",this.stoptime,this.rampperc);
65  }
66 
67 
68  function plot(varargin) {
69  plot@general.functions.AFunGen(this, " R ", [0 this.stoptime*1.5], varargin[:]);
70  }
71 
72 
73  public: /* ( Static ) */
74 
75  static function res = test_ConstantUntil() {
76  f = general.functions.ConstantUntil;
77  f.plot;
78  f = general.functions.ConstantUntil(5,.1);
79  fh = f.getFunction;
80  res = fh(4.5) == 1 && fh(4.75) == .5 && fh(5) == 0;
81  f.plot;
82  }
83 
84 
85 
86 };
87 }
88 }
89 
90 
91 
function [ fhandle , df ] = getFunction()
Definition: ConstantUntil.m:51
static function res = test_ConstantUntil()
Definition: ConstantUntil.m:75
A variable number of input arguments.
AFUNGEN Summary of this class goes here Detailed explanation goes here.
Definition: AFunGen.m:19
A constant function of value 1 util the given time. Uses a ramp to go down from 1 to 0 for continuity...
Definition: ConstantUntil.m:19