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
AFunGen.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 AFunGen
20  :public handle {
28  public:
29 
30  xLabel = "t "[ms]"";
31 
32  yLabel = "value";
33 
34 
35  public:
36 
37  function pm = plot(varargin) {
38  [f, df] = this.getFunction;
39  args = [];
40  if ~isempty(df)
41  args = [false, 1, 2];
42  end
43  pm = PlotManager(args[:]);
44  pm.UseFileTypeFolders= false;
45  pm.LeaveOpen= true;
46 
47 
48  i.CaseSensitive= true;
49  i.KeepUnmatched= true;
50  i.FunctionName= " general.functions.AFunGen#plot ";
51  i.addParamValue('PM',pm,@(v)isa(v,'PlotManager'));
52  i.addParamValue('R',0:.1:1000);
53  i.addParamValue('P',{});
54  i.addParamValue('AX',[],@(v)all(ishandle(v)));
55  i.parse(varargin[:]);
56  res = i.Results;
57  pm = res.PM;
58  if length(res.R) == 2
59  range = linspace(res.R(1),res.R(2),2000);
60  else
61  range = res.R;
62  end
63 
64  if ~isempty(res.AX)
65  hold(res.AX(1)," on ");
66  plot(res.AX(1),range,f(range),res.P[:]);
67  hold(res.AX(2)," on ");
68  plot(res.AX(2),range,f(range),res.P[:]);
69  else
70  mc = metaclass(this);
71  ax = pm.nextPlot(mc.Name,...
72  sprintf(" Plot of %s\n%s ",mc.Name,this.getConfigStr),...
73  this.xLabel,this.yLabel);
74  plot(ax,range,f(range),res.P[:]);
75  if ~isempty(df)
76  ax = pm.nextPlot([mc.Name " _deriv "],...
77  sprintf(" Plot of %s-derivative\n%s ",mc.Name,this.getConfigStr),...
78  this.xLabel,[this.yLabel " / " this.xLabel]);
79  plot(ax,range,df(range),res.P[:]);
80  end
81  end
82  if nargout > 0
83  pm.done;
84  end
85  }
86 
87 
88  function plottofigure(fignr,range,varargin) {
89  if nargin < 3
90  range = 0:.1:1000;
91  if nargin < 2
92  fignr = gcf;
93  end
94  elseif length(range) == 2
95  range = linspace(range(1),range(2),2000);
96  end
97  ax = get(fignr," Children ");
98  if numel(ax) < 2
99  error(" Need two axes handles. ");
100  end
101  this.plot(range, " AX ", ax, varargin[:]);
102  }
103 
104 
105  function sum = plus(other) {
106  if ~isa(this," general.functions.AFunGen ") || ~isa(other," general.functions.AFunGen ")
107  error(" Addition not defined for non-AFunGen classes. ");
108  end
109  sum = general.functions.FuncSum(this, other);
110  }
119  public: /* ( Abstract ) */
120 
121  virtual function [fhandle , dfhandle ] = getFunction() = 0;
122 
123 
124  virtual function str = getConfigStr() = 0;
125 
126 
127 
128 };
129 }
130 }
131 
132 
133 
function sum = plus(other)
Provides an override for the simple sum of two AFunGen.
Definition: AFunGen.m:105
virtual function str = getConfigStr()
function pm = plot(varargin)
Definition: AFunGen.m:37
PlotManager: Small class that allows the same plots generated by some script to be either organized a...
Definition: PlotManager.m:17
Matlab's base handle class (documentation generation substitute)
virtual function [ fhandle , dfhandle ] = getFunction()
A variable number of input arguments.
AFUNGEN Summary of this class goes here Detailed explanation goes here.
Definition: AFunGen.m:19
Speed test * all(1:3)
function plottofigure(fignr, range, varargin)
Definition: AFunGen.m:88