rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
plot_error_landscape.m
Go to the documentation of this file.
1 function plot_error_landscape(output)
2 %function plot_error_landscape(output)
3 % plots an output structure generated by stochastic_error_estimation()
4 %
5 % Parameters:
6 % output: output structure generated by stochastic_error_estimation()
7 %
8 % Required fields of output:
9 % errs: error values
10 % inds: time index of maximum error values in trajectory
11 % run_name: unique name of error estimation run used for plot titles.
12 % bound: maxmimum error values to be plotted. Above this values error
13 % display is cropped.
14 % stab_limit: error values below this value are shaded in a different color in
15 % surface plots.
16 % pf_descr: plot field description for axis labeling.
17 % tsamples: plot field ranges
18 % samples: combined plot field ranges
19 %
20 % Optional fields of output:
21 % error_label: label for the y respectively z axis where the error or error
22 % estimator is plotted. (default='error')
23 
24 i = logical(output.errs>output.bound);
25 output.errs(i) = output.bound;
26 i = logical(isnan(output.errs));
27 output.errs(i) = output.bound;
28 C = ones(size(output.errs));
29 i = logical(output.errs<output.stab_limit);
30 C(i) = 2;
31 
32 if ~isfield(output,'error_label')
33  output.error_label = 'error';
34 end
35 
36 figure;
37 if length(output.tsamples) == 2
38  if isempty(find(C==1,1)); % i.e. all stable
39  surf(output.tsamples{1},output.tsamples{2},output.errs');
40  else % some not stable
41  surf(output.tsamples{1},output.tsamples{2},output.errs',C');
42  end;
43  shading interp;
44  % figure, pcolor(Ms, Ns,C);
45  set(gca,'Zscale','log');
46  xlabel(output.pf_descr{1});
47  ylabel(output.pf_descr{2});
48  zlabel(output.error_label);
49 else
50  plot(output.samples, output.errs');
51  xlabel(output.pf_descr{1});
52  ylabel(output.error_label);
53  set(gca,'Yscale','log');
54 end
55 run_name = strrep(output.run_name,'_',' ');
56 title([run_name,' L-infty([0,T],L2) error']);
57 
58 figure;
59 if length(output.tsamples) == 2
60  surf(output.tsamples{1}, output.tsamples{2}, real(output.inds'));
61  xlabel(output.pf_descr{1});
62  ylabel(output.pf_descr{2});
63  zlabel('time index');
64 else
65  plot(output.samples, output.inds');
66  xlabel(output.pf_descr{1});
67  zlabel('time index');
68 end
69 
70 title('time index of maximum l2-error');
71 %set(gca,'Zscale','log');
function plot_error_landscape(output)
plots an output structure generated by stochastic_error_estimation()