-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotEnveloppe.m
More file actions
41 lines (36 loc) · 814 Bytes
/
plotEnveloppe.m
File metadata and controls
41 lines (36 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function plotEnveloppe(h,X,Y,YE,c,nz,sty)
%plotEnveloppe plots confidence enveloppe around curves.
% plotEnveloppe(h,X,Y,YE,c,nz,sty) is an utility function.
%
% Copyright (c) 2024, Benjamin Zoller
% All rights reserved.
%
% This source code is licensed under the MIT license found in the
% LICENSE file in the root directory of this source tree.
if nargin < 6
nz = 0;
sty = '-';
end
if nargin < 7
sty = '-';
end
I = ~isnan(Y) & ~isinf(Y);
X = X(I);
Y = Y(I);
YE = YE(:,I);
if size(YE,1)>1
Ylow = YE(1,:);
Yup = YE(2,:);
else
Ylow = Y-YE;
Yup = Y+YE;
end
if nz == 1
Ylow(Ylow<1e-16) = 1e-16;
Yup(Yup<1e-16) = 1e-16;
end
x = [X,X(end:-1:1)];
y = [Ylow,Yup(end:-1:1)];
patch(h,x,y,c,'FaceAlpha',0.3,'LineStyle','none');
plot(h,X,Y,sty,'color',c,'linewidth',2)
end