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
System.m
Go to the documentation of this file.
1 namespace models{
2 namespace motoneuron{
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 System
39  public: /* ( Transient ) */
40 
41  d = "[]";
53  public: /* ( Constant ) */
54 
55  static const dm = 6;
63  static const .double C_m_slow = 0.58;
76  static const C_m_fast = 1;
77 
78 
79  public:
80 
107  public:
108 
110  this = this@models.BaseFirstOrderSystem(model);
111 
112  this.addParam(" fibre_type ", 0, " Range ", [0 1]);
113  this.addParam(" mean_current_factor ", 3, " Range ", [0 9]);
114 
115  this.NumStateDofs= 6;
116 
117  /* Setup noise input */
118  ng = models.motoneuron.NoiseGenerator;
119  this.noiseGen= ng;
120  this.Inputs[1] = @ng.getInput;
121 
122  /* Load mean current limiting polynomial */
123  s = load(models.motoneuron.Model.FILE_UPPERLIMITPOLY);
124  this.upperlimit_poly= s.upperlimit_poly;
125 
126  /* % Set system components
127  * Core nonlinearity */
128  this.f= models.motoneuron.Dynamics(this);
129 
130  /* Linear input B for motoneuron
131  * input conversion matrix, depends on fibre type. Has only one
132  * entry in second row. */
133  B = dscomponents.AffLinInputConv;
134  /* Base noise input mapping */
135  B.addMatrix(" 1./(pi*(exp(log(100)*mu(1,:))*3.55e-05 + 77.5e-4).^2) ",...
136  sparse(2,1,1,6,2));
137  /* Independent noise input mapping with ยต_2 as mean current factor */
138  B.addMatrix(" mu(2,:)./(pi*(exp(log(100)*mu(1,:))*3.55e-05 + 77.5e-4).^2) ",...
139  sparse(2,2,1,6,2));
140  this.B= B;
141 
142  /* Constant initial values */
143  this.x0= dscomponents.ConstInitialValue(zeros(6,1));
144 
145  this.updateDimensions;
146  }
156 
157  /* Limit mean current depending on fibre type */
159  mu(2) = min(polyval(this.upperlimit_poly,mu(1)),mu(2));
160  end
161 
162  prepareSimulation@models.BaseFirstOrderSystem(this, mu, inputidx);
163  }
178  setConfig@models.BaseFirstOrderSystem(this, mu, inputidx);
179  this.noiseGen.setFibreType(mu(1));
180  this.MaxTimestep= this.Model.dt*1000;
181  }
182 
183 
184  function pm = plot(double t,matrix<double> y,pm) {
185  if nargin < 4
186  n = 2;
187  if ~isempty(this.mu)
188  n = 3;
189  end
190  pm = PlotManager(false,1,n);
191  pm.LeaveOpen= true;
192  end
193 
194  /* Input */
195  h = pm.nextPlot(" input "," Input currents (base + indep) "," time "," value ");
196  plot(h,t,this.noiseGen.getInput(t));
197 
198  /* Effective input */
199  if ~isempty(this.mu)
200  h = pm.nextPlot(" eff_input "," Effective input current "," time "," value ");
201  B = this.B.compose([],this.mu);
202  plot(h,t,B(2,:)*this.noiseGen.getInput(t));
203  end
204 
205  /* Firing rate */
206  h = pm.nextPlot(" moto "," Motoneuron V_s "," time "," value ");
207  plot(h,t,y(2,:));
208 
209  if nargin < 4
210  pm.done;
211  end
212  }
213 
214 
215 };
216 }
217 }
218 
219 
function pm = plot(double t,matrix< double > y, pm)
Definition: System.m:184
static const C_m_fast
Definition: System.m:76
MotoModel: Motoneuron model.
Definition: Model.m:19
* polyval(pol, slen)
The base class for any KerMor detailed model.
Definition: BaseFullModel.m:18
double dt
The desired time-stepsize for simulations.
Definition: BaseModel.m:291
static const .double C_m_slow
Membrane capacitance. Different values for different fibre types, due to different action potential p...
Definition: System.m:63
dscomponents.AInputConv B
The input conversion.
logical FibreTypeDepMaxMeanCurrent
Flag that determines if the mean current parameter is constrained depending on the fibre type paramet...
Definition: Model.m:57
An integer value.
System(models.BaseFullModel model)
Call superclass constructor.
Definition: System.m:109
PlotManager: Small class that allows the same plots generated by some script to be either organized a...
Definition: PlotManager.m:17
inputidx
The current inputindex of the function .
noiseGen
The NoiseGenerator to obtain the inputs u(t)
Definition: System.m:81
dscomponents.AInitialValue x0
Function handle to initial state evaluation.
mu
The current parameter for simulations, [] is none used.
Inputs
The system's possible input functions. A cell array of function handles, each taking a time argument ...
MotoSystem: The global dynamical system used within the MotoModel.
Definition: System.m:19
static const dm
Dimension of motoneuron part.
Definition: System.m:55
dscomponents.ACoreFun f
The core f function from the dynamical system.
function prepareSimulation(colvec< double > mu,integer inputidx)
Limits the mean input current to a maximum value depending on the fibre type, so that the frequency o...
Definition: System.m:155
function setConfig(colvec< double > mu,integer inputidx)
Definition: System.m:177
upperlimit_poly
The upper limit polynomial for maximum mean current dependent on the fibre type.
Definition: System.m:92
double MaxTimestep
The maximum timestep allowed for any ODE solvers.
function ModelParam p = addParam(char name, default, varargin)
Adds a parameter with the given values to the parameter collection of the current dynamical system...
Base class for all KerMor first-order dynamical systems.
d
debug output
Definition: System.m:41