How to plot a shaded range between a min and max y value for the same x value
Show older comments
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
Answers (1)
Mischa Kim
on 24 Feb 2015
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)
Categories
Find more on App Building in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!