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
Ramp.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 
19 class Ramp
27  private:
28 
29  ramptime;
30 
31  max;
32 
33  starttime;
34 
35 
36  public:
37 
38  Ramp(ramptime,max,starttime) {
39  if nargin < 3
40  starttime = 0;
41  if nargin < 2
42  max = 1;
43  if nargin < 1
44  ramptime = 1;
45  end
46  end
47  end
48  this.ramptime= ramptime;
49  this.max= max;
50  this.starttime= starttime;
51  }
52 
53 
54  function [fhandle , df ] = getFunction() {
55  rt = this.ramptime;
56  if rt <= 0
57  fhandle = @(t)0;
58  else
59  maxval = this.max;
60  start = this.starttime;
61  fhandle = @(t)(t >= start) .* (maxval * (((t-start)<rt).*(t-start)/rt + (t>=rt+start)));
62  end
63  df = [];
64  }
65 
66 
67  function plot(varargin) {
68  varargin = [[" R ", [this.starttime*.75 this.starttime+this.ramptime*1.33]] varargin];
69  plot@general.functions.AFunGen(this, varargin[:]);
70  }
71 
72 
73  function str = getConfigStr() {
74  str = sprintf(" Start: %g, Ramptime: %g, Max:%g ",this.starttime,this.ramptime,this.max);
75  }
76 
77 
78  public: /* ( Static ) */
79 
80  static function res = test_Ramp() {
81  f = general.functions.Ramp;
82  f.plot;
83  f = general.functions.Ramp(10,2,4);
84  fh = f.getFunction;
85  res = fh(2) == 0 && fh(4) == 0 && fh(9) == 1 && fh(14) == 2;
86  f.plot;
87  }
88 
89 
90 
91 };
92 }
93 }
94 
95 
96 
function [ fhandle , df ] = getFunction()
Definition: Ramp.m:54
function plot(varargin)
Definition: Ramp.m:67
function str = getConfigStr()
Definition: Ramp.m:73
A variable number of input arguments.
Ramp(ramptime, max, starttime)
Definition: Ramp.m:38
AFUNGEN Summary of this class goes here Detailed explanation goes here.
Definition: AFunGen.m:19
static function res = test_Ramp()
Definition: Ramp.m:80