17 function [pm , Y , E ] =
ParamSweep(rmodel,mu,inputidx,param,paramvals,pm) {
22 pidx = rmodel.getParamIndexFromName(param);
26 pname = rmodel.System.Params(pidx).Name;
28 error(
" param must be either a char array (parameter name) or positive parameter index ");
30 npar = length(paramvals);
32 error(
" Parameter values to sweep must be given. ");
38 haveerrest = ~isempty(rmodel.ErrorEstimator) && rmodel.ErrorEstimator.Enabled;
41 Y = zeros(npar,length(rmodel.Times));
46 pi =
ProcessIndicator(
" Starting parameter sweep with %d parameter sets for %s... ",npar,
false,npar,pname);
48 mu(pidx) = paramvals(idx);
49 [
t, y] = rmodel.simulate(mu, inputidx);
56 E(idx,:) = rmodel.ErrorEstimator.OutputError;
65 [T,MU] = meshgrid(
t,paramvals);
68 ustr = sprintf(
" , u_%d ",inputidx);
70 tit = sprintf(
" Outputs for parameter sweep of '%s' (idx:%d) from %1.3f to %1.3f, base \\mu = [%s]%s ",...
71 pname,param,paramvals(1),paramvals(end),num2str(mu^
t),ustr);
72 h = pm.nextPlot(
" param_sweep ",tit,
" t ",sprintf(
" Parameter %d: %s ",param,pname));
75 obj = surf(h,T,MU,
Y+E,
" EdgeColor ",
" none ",
" FaceColor ",
" red ");
82 surf(h,T,MU,
Y,
" EdgeColor ",
" none ");
87 obj = surf(h,T,MU,
Y-E,
" EdgeColor ",
" none ",
" FaceColor ",
" red ");
function [ pm , Y , E ] = ParamSweep(rmodel, mu, inputidx, param, paramvals, pm)
ParamSweep: Plots the output with error bounds for a range of one specified parameter.
PlotManager: Small class that allows the same plots generated by some script to be either organized a...
function res = isposintscalar(value)
isposintscalar: Backwards-compatibility function for matlab versions greater than 2012a ...
static function rowvec< double > n = L2(matrix< double > x)
Returns the discrete norm for each column vector in x.
Norm: Static class for commonly used norms on sets of vectors.
ProcessIndicator: A simple class that indicates process either via waitbar or text output...