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
EstimatorParamSweep.m
Go to the documentation of this file.
1 
2 
3 /* (Autoinserted by mtoc++)
4  * This source code has been filtered by the mtoc++ executable,
5  * which generates code that can be processed by the doxygen documentation tool.
6  *
7  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
8  * Except for the comments, the function bodies of your M-file functions are untouched.
9  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
10  * attached source files that are highly readable by humans.
11  *
12  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
13  * the correct locations in the source code browser.
14  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
15  */
16 
17 function [Y , E ] = EstimatorParamSweep(ea,mu,unused1,param,rowvec<double> paramvals) {
18 
19 
20 /* Validity checks */
21 if ~isa(ea," EstimatorAnalyzer ")
22  error(" The first argument must be a EstimatorAnalyzer instance. ");
23 end
24 if ischar(param)
25  pidx = ea.ReducedModel.getParamIndexFromName(param);
26  pname = param;
27 elseif isposintscalar(param)
28  pidx = param;
29  pname = ea.ReducedModel.System.Params(pidx).Name;
30 else
31  error(" param must be either a char array (parameter name) or positive parameter index ");
32 end
33 npar = length(paramvals);
34 if npar == 0
35  error(" Parameter values to sweep must be given. ");
36 end
37 
38 /* % Iterate over parameter values
39  * mu(pidx) = paramvals(1);
40  * [errs, ctimes, relerrs] = ea.getErrorEstimates(mu, inputidx, true);
41  * fprintf('Estimator analyzer parameter sweep 1/%d with %s=%f\n',npar,pname,mu(pidx));
42  * for idx = 2:npar
43  * mu(pidx) = paramvals(idx);
44  * [errs(:,:,idx), ctimes(idx,:), relerrs(:,:,idx)] = ea.getErrorEstimates(mu, inputidx, true);
45  *
46  * fprintf('Estimator analyzer parameter sweep %d/%d with %s=%f\n',idx,npar,pname,mu(pidx));
47  * end */
48 load tmp;
49 
50 /* % Prepare plot */
51 [T, MU] = meshgrid(ea.Model.Times,paramvals);
52 tit = sprintf(" Error estimator analysis for parameter sweep of '%s' from %1.3f to %1.3f, base \\mu = [%s] ",...
53  pname,paramvals(1),paramvals(end),num2str(mu^t));
54 
55 /* %% Upper bound
56  * if rmodel.ErrorEstimator.Enabled
57  * obj = mesh(T,MU,Y+E,'EdgeColor','none','FaceColor','red');
58  * alpha(obj,.3);
59  * % mesh(T,MU,Y+E,'EdgeColor','none','FaceColor','red');
60  * title(tit); axis tight; xlabel('t'); ylabel(pname);
61  * end */
62 
63 /* % y plot */
64 p = figure;
65 ax = gca(p);
66 rotate3d(ax," on ");
67 view(ax,9,16);
68 inv = figure(" Visible "," off ");
69 iax = gca(inv);
70 hold on;
71 /* cm = jet; */
72 cd = cell.empty;
73 for idx = 1:size(errs,1)/* #ok */
74 
75  Z = squeeze(errs(idx,:,:))^t;
76  /* surf(ax,T,MU,Z,'EdgeColor','none','FaceColor',cm(idx*floor(size(cm,1)/size(errs,1)),:)); */
77  h = surf(iax,T,MU,Z," EdgeColor "," none ");
78  cd[idx] = get(h," CData ");
79  set(h," Parent ",ax);
80 end
81 title(tit);
82 emin = min(errs(:));
83 /* axis(ax,[0 ea.Model.T 1 npar emin*.9 max(emin,1e4)]); */
84 xlabel(" Time t "); ylabel(sprintf(" Parameter %s value ",pname)); zlabel(" Error estimates ");
85 zlim(ax,[emin*.9 max(emin,1e4)]);
86 
87 cm = jet;
88 colormap(ax,cm);
89 for idx = 1:size(errs,1)
90  ncd = cd[idx];
91  /* ncd = ncd-min(ncd(:)); */
92  ncd = size(cm,1)*max(ncd(:))./ncd;
93  set(h," CData ",ncd," CDataMapping "," direct ");
94 end
95 close(inv);
96 
97 /* %% Lower bound
98  * if rmodel.ErrorEstimator.Enabled
99  * figure;
100  * colormap jet;
101  * obj = surf(T,MU,Y-E,'EdgeColor','none','FaceColor','red');
102  * alpha(obj,.3);
103  * % mesh(T,MU,Y-E,'EdgeColor','none','FaceColor','red');
104  * hold on;
105  * end */
106 
107 }
A MatLab cell array or matrix.
function [ Y , E ] = EstimatorParamSweep(ea, mu, unused1, param,rowvec< double > paramvals)
ParamSweep: Plots the output with error bounds for a range of one specified parameter.
function res = isposintscalar(value)
isposintscalar: Backwards-compatibility function for matlab versions greater than 2012a ...