63 static const dsa = 56;
88 static const .rowvec<double>
ForceOutputScalingPolyCoeff = 1e5*
"[0.072141692014344 -0.456658053996476 1.274105896595146 -2.041231359447655 2.058191740934228 -1.353159489096666 0.584711952400098 -0.164458365881107 0.029358733675881 -0.003174883073694 0.000165817182406 0.000048348565452 0.000012193246968]";
153 this =
this@models.BaseFirstOrderSystem(model);
155 this.
addParam(
" fibre_type ", 0,
" Range ", [0 1]);
156 this.
addParam(
" mean_current_factor ", 3,
" Range ", [0 9]);
163 this.
f= models.motorunit.SHDynamics(
this);
166 s = load(models.motoneuron.Model.FILE_UPPERLIMITPOLY);
170 ng = models.motoneuron.NoiseGenerator;
172 this.
Inputs[1] = @ng.getInput;
175 this.
B= this.assembleB;
178 this.
C= this.assembleC;
182 if model.DynamicInitialConditions
183 this.
x0= this.assembleX0;
185 this.
x0= dscomponents.ConstInitialValue(this.getConstInitialStates);
221 setConfig@models.BaseFirstOrderSystem(
this, mu, inputidx);
225 if this.
Model.SinglePeakMode
226 this.peakstart=
false;
240 if ~strcmp(flag,
" done ")
241 if y(this.
dm+1) > -20 && ~this.peakstart
242 this.peakstart=
true;
243 elseif y(this.
dm+1) < -20 && this.peakstart
244 this.peakstart=
false;
245 this.
f.hadpeak=
true;
255 function x0 = assembleX0() {
256 mc = metaclass(
this);
257 s = load(fullfile(fileparts(which(mc.Name)),
" x0coeff.mat "));
258 x0 = dscomponents.AffineInitialValue;
261 x0.addMatrix(sprintf(
" polyval([%s],mu(1)) ",...
262 sprintf(
" %g ",s.coeff(
k,:))),full(sparse(
k,1,1,m,1)));
277 function B = assembleB() {
278 B = dscomponents.AffLinInputConv;
280 B.addMatrix(
" 1./(pi*(exp(log(100)*mu(1,:))*3.55e-05 + 77.5e-4).^2) ",...
281 sparse(2,1,1,this.
dm+this.
dsa,2));
283 B.addMatrix(
" mu(2,:)./(pi*(exp(log(100)*mu(1,:))*3.55e-05 + 77.5e-4).^2) ",...
284 sparse(2,2,1,this.
dm+this.
dsa,2));
297 function C = assembleC() {
298 C = dscomponents.AffLinOutputConv;
300 C.addMatrix(
" 1 ",sparse(1,7,1,2,this.
dm+this.
dsa));
303 if this.
Model.SingleTwitchOutputForceScaling
306 C.addMatrix(str, sparse(2,59,1,2,this.
dm+this.
dsa));
316 function x0 = getConstInitialStates() {
317 x0_sarc = zeros(56,1);
318 x0_sarc(1:14) = [-79.974; -80.2; 5.9; 150.9; 5.9; 12.7; 133;...
319 133; 0.009466; 0.9952; 0.0358; 0.4981; 0.581; 0.009466];
320 x0_sarc(15:37) = [0.9952; 0.0358; 0.4981; 0.581; 0; 0; 0; 0; 0; 1;...
321 0; 0; 0; 0; 0.1; 1500; 0.1; 1500; 25; 615; 615; 811; 811];
322 x0_sarc(38:45) = [16900; 16900; 0.4; 0.4; 7200; 7200; 799.6; 799.6];
323 x0_sarc(46:54) = [1000; 1000; 3; 0.8; 1.2; 3; 0.3; 0.23; 0.23];
324 x0_sarc(55:56) = [0.23; 0.23];
326 x0 = [zeros(6,1); x0_sarc];
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...
The base class for any KerMor detailed model.
static const .double C_m_slow
Membrane capacitance. Different values for different fibre types, due to different action potential p...
function updateSparsityPattern()
dscomponents.AInputConv B
The input conversion.
Model
The Model this System is attached to.
SHSystem(models.BaseFullModel model)
Call superclass constructor.
inputidx
The current inputindex of the function .
static const dm
Dimension of motoneuron part.
static const dsa
Dimension of single sarcomer cell part.
function updateDimensions()
dscomponents.AInitialValue x0
Function handle to initial state evaluation.
mu
The current parameter for simulations, [] is none used.
function setConfig(colvec< double > mu,integer inputidx)
Sets the configuration for the upcoming simulation of the model.
Inputs
The system's possible input functions. A cell array of function handles, each taking a time argument ...
SHSystem: The global dynamical system used within the Shorten motorunit model.
dscomponents.LinearOutputConv C
The output conversion Defaults to an LinearOutputConv instance using a 1-matrix, which just forwards ...
dscomponents.ACoreFun f
The core f function from the dynamical system.
upperlimit_poly
The upper limit polynomial for maximum mean current dependent on the fibre type.
function status = singlePeakModeOutputFcn(unused1,matrix< double > y, flag)
static const .rowvec< double > ForceOutputScalingPolyCoeff
Coefficients of the polynomial used for force output scaling.
noiseGen
The NoiseGenerator to obtain the inputs u(t)
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.