Examples
This page will contain several example scripts/functions using the SBaddon package. So far there is only one.
Simple Parameter Estimation Function
The following two functions should be placed in the same file. They perform a very basic parameter estimation for a given model and given referencedata. These functions should be seen as an example on how MEX simulation functions can be used and not as "state-of-the-art" in parameter estimation.
MEXmodel: The MEX simulation function to use
timevector: Time vector to use for simulations (same as used to obtain the reference data)
reference: Matrix containing reference data used to calculate the cost in the costfunction
parameters: Cell-array containing the names of the parameters that are to be optimized
parameterv: Vector with initial guesses for the parameters
% model, and parameter names to cost function
MEXmodel_global = MEXmodel;
timevector_global = timevector;
reference_global = reference;
parameters_global = parameters;
optionsSimplexSB = [];
optvalues = simplexSB(@costfunction,parameterv,optionsSimplexSB);
pv = createparametervectorSBAO(MEXmodel_global,parameters_global,x)
optionsMEXmodel = [];
simdata = feval(MEXmodel_global,timevector_global,[],pv,optionsMEXmodel);
cost = inf;
% (needs to have the same format as the referencedata). In this example it is
% assumed that all state variables are measured and available in the
% referencedata in the same order as in the simulation data
simulation = simdata.statevalues;
cost = norm(simulation-reference_global);
