在2条曲线之间填充区域MATLAB [英] Fill area between 2 curves matlab

查看:1670
本文介绍了在2条曲线之间填充区域MATLAB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有3个向量:均值,均值+标准差和均值标准差,如何填充均值+标准差和均值标准差之间的空间并使第三个矢量均值"可见? 我这样尝试过

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);

,但以均值+标准差填充整个空间. 在该代码中,y_m = mean; y_std1 =平均值+标准差; y_std2 =平均标准偏差.这些向量是从excel导入的.

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.

推荐答案

像这样的东西可能会提供您想要的东西

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)

这篇关于在2条曲线之间填充区域MATLAB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆