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

1 次查看(过去 30 天)
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);

采纳的回答

Adam Danz
Adam Danz 2020-2-10
编辑:Adam Danz 2020-2-11
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')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surfaces, Volumes, and Polygons 的更多信息

标签

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by