How to plot a shaded range between a min and max y value for the same x value

조회 수: 8 (최근 30일)
Oliver
Oliver 2015년 2월 24일
답변: Mischa Kim 2015년 2월 24일
How do I plot to create an image this this. For each x value I have minimum and maximum values. As shown in the image in the link below:
Thank you very much

답변 (1개)

Mischa Kim
Mischa Kim 2015년 2월 24일
Oliver, something like this?
t = 0:0.1:10;
y1 = sin(t);
y2 = sin(t + 0.1) + 0.5;
y3 = cos(t).^2;
y4 = cos(t + 0.2).^2 - 0.2;
figure
hold on
fill([t fliplr(t)],[y2 fliplr(y1)] ,'r')
fill([t fliplr(t)],[y4 fliplr(y3)] ,'b')
grid
alpha(0.15)

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by