1 function [mu_grid,error_ma] = plot_error_domain(model, online_data, options)
2 %
function [mu_grid,error_ma] = plot_error_domain(model, online_data, options)
4 % Function plotting the error map over the parameter domain (only 2D)
6 % Optional fields of option:
8 % intervals: density of grid
for error map in the domain,
default [22,22]
9 % figureNr: Figure Nr.
for the plot window,
default is opening a
new
11 % mu_grid:
if mu_grid already exists it can be given here
12 % error_matrix:
if error matrix already exists it can be given here,
if not
14 % holdOn:
if set to 1 no
new figure is drawn but the actual figure is
16 % maxValue: maximum error on color scale to ensure
17 % comparability between several plots
18 % transparency: value between 0 and 1 defining the transparency of the
20 % colormap_autumn: flag
if the colormap autumn should be used
22 % Markus Dihlmann 25.03.2010
26 if~(isfield(model,
'verbose'))
35 if ~isfield(options,
'intervals')
36 options.intervals=[22,22];
39 if ~isfield(options,
'holdOn')
45 if ~isfield(options,'transparency')
46 options.transparency=1;
49 if ~(isfield(options,'mu_grid')&&isfield(options,'error_matrix'))
50 %%Calculate the error matrix and the grid
51 display('Calculating estimated test error');
52 Nrows=options.intervals(1);
53 Ncols=options.intervals(2);
55 gridparams.range = model.mu_ranges;
56 gridparams.numintervals=[Nrows,Ncols];
58 N_test=get(mu_grid,'nvertices');
59 mu_values=get(mu_grid,'vertex');
61 est_error=zeros(1,N_test);
62 %error_matrix=zeros(Nrows+1,Ncols+1);
64 %Choose a mu from range by random choice
66 model = set_mu(model,mu');
67 %perform a reduced simulation and take the estiamated error of last
70 rb_sim_data = rb_simulation(model, online_data);
72 %add error to total error
73 est_error(i) = rb_sim_data.DeltaX(end);
82 %normalisation of errors:
84 elementvert = get(mu_grid,'vertexindex');
85 num_elements = get(mu_grid,'nelements');
86 X=zeros(4,num_elements);
87 Y=zeros(4,num_elements);
88 error_ma=zeros(4,num_elements);
91 X(j,i)=mu_values(elementvert(i,j),1);
92 Y(j,i)=mu_values(elementvert(i,j),2);
93 error_ma(j,i)=est_error(elementvert(i,j));
96 T=[1,0,0,0;0,1,0,0;0,0,0,1;0,0,1,0];
101 mu_grid = options.mu_grid;
102 mu_values=get(mu_grid,'vertex');
103 error_ma = options.error_matrix;
104 elementvert = get(mu_grid,'vertexindex');
105 num_elements = get(mu_grid,'nelements');
106 X=zeros(4,num_elements);
107 Y=zeros(4,num_elements);
111 X(j,i)=mu_values(elementvert(i,j),1);
112 Y(j,i)=mu_values(elementvert(i,j),2);
115 T=[1,0,0,0;0,1,0,0;0,0,0,1;0,0,1,0];
122 if(options.holdOn==1)
125 if isfield(options,'figureNr')
126 figure(options.figureNr);
131 %normation of color-map
132 if isfield(options,'maxValue');
133 caxis([0,options.maxValue]);
136 if isfield(options,'colormap_autumn')
137 if options.colormap_autumn
138 colormap(flipud(autumn));
142 patch(X,Y,error_ma,'LineStyle','none','FaceAlpha',options.transparency);
function r = verbose(level, message, messageId)
This function displays messages depending on a message-id and/or a level. Aditionally you can set/res...
A hierarchical cubegrid of arbitrary dimension.