61 function colvec<double>x =
customSolve(odefun,
double t,x0,outputtimes) {
66 if any(
t(2:end)-
t(1:end-1) - dt > 100*eps)
67 error(
" non-equidistant dt timesteps. ");
73 ed = solvers.SolverEventData;
76 x = [x0 zeros(size(x0,1),steps-1)];
78 s = this.model.System;
81 M = speye(length(x0));
84 mdep = s.M.TimeDependent;
98 M = s.M.evaluate(
t(idx+1));
131 dis =
" final-detailed ";
132 options_fsolve = optimset(
" Display ", dis,
" Jacobian ",
" on ", ...
133 " MaxIter ", 2000, ...
134 " MaxFunEvals ", 10000, ...
136 options_fsolve = optimset(options_fsolve, ...
137 " DerivativeCheck ",
" off ",...
138 " Diagnostics ",
" off ");
144 nonlin_fun_h = @nonlin_fun;
147 newx = fsolve(nonlin_fun_h, oldx, options_fsolve );
154 this.
notify(
" StepPerformed ",ed);
162 function [dx, jac] = nonlin_fun(x)
163 dx = M * (x - oldx) - dt*odefun(
t(idx+1), x);
164 jac = M - dt * s.f.getStateJacobian(x,
t(idx+1));
notify
Broadcast a notice that a specific event is occurring on a specified handle object or array of handle...
The base class for any KerMor detailed model.
logical RealTimeMode
Determines if the solver's StepPerformed event should be used upon solving instead of returning the f...
BaseCustomSolver: Base class for all self-implemented solvers.
virtual function M = evaluate(double t,colvec< double > mu)
FullyImplSolver: Solver for fully nonlinear ODE's (using Newton iterations)
solvers.SolverTypes SolverType
The type of the solver.
FullyImplEuler(models.BaseFullModel model)
double MaxStep
Maximum time step for solver.
dscomponents.AMassMatrix M
The mass matrix of the ODE .
function colvec< double > x = customSolve(odefun,double t, x0, outputtimes)