MATLAB: How to shade the area between the upper line and the lower line? thank you!

MATLABplot

clc; clear
upper=[54.48 62.83 46.53 44.11 46.33 49.95 53.68 58.03 62.99 69.33];
lower=[54.48 45.65 40.37 40.87 42.38 44.99 47.65 50.70 53.92 57.89];
t=[0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5];
plot(t,upper);
hold on;
plot(t,lower);

Best Answer

fliplr() flips the vector left to right.
patch() plots the colored patch between the lines.
x = [t, fliplr(t)]; % t is a row vector
y = [lower, fliplr(upper)]; % lower and upper are row vectors
patch(x,y,'green')