Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

If i have 3 vectors: mean, mean+standard deviation and mean-standard deviation, how can I fill the space between mean+standard deviation and mean-standard deviation and keep visible the third vetor "mean"? I tried like this

h1 = area(x,y_m);
h2= area(x,y_std1);
h3= area(x,y_std2);

but it fills the entire space under mean+standard deviation. In that code, y_m=mean; y_std1=mean+standard deviation; y_std2=mean-standard deviation. These vectors are imported from excel.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
204 views
Welcome To Ask or Share your Answers For Others

1 Answer

Something like this may provide what you are looking

% random data
x = 0:0.1:10;
y = sin(x);
ystd = ones(size(x))*1;
y_std1 = y+ystd;
y_std2 = y-ystd;

figure
fill([x fliplr(x)],[(y_std1) fliplr(y_std2)],'r'); hold on
plot(x,y)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...