How to shade area between an upper bound and lower bound curve?

12 ビュー (過去 30 日間)
Andrew Poissant
Andrew Poissant 2018 年 1 月 18 日
コメント済み: Star Strider 2018 年 1 月 18 日
I have an upper bound curve comprised of vectors xmax, ymax. I also have a lower bound curve comprised of vectors xmin, ymin. The two curves do not connect to make a polygon but have the same number of elements. All four vectors are 1x361. How could I shade the area in between the curves given the upper and lower bounds? The .mat files for each vector are attached.

採用された回答

Star Strider
Star Strider 2018 年 1 月 18 日
It would help to have at least a sample of your data. Without it, a guess is the best I can do.
With the monotonically-increasing x-vector in the first row, and the y-vector in the second row for each matrix, use the patch (link) function:
v = rand(1, 361);
vs = sort(v);
UpperBound = [vs; v + 3];
LowerBound = [vs; v + 1];
figure(1)
patch([UpperBound(1,:) fliplr(LowerBound(1,:))], [UpperBound(2,:) fliplr(LowerBound(2,:))], [0.1 0.5 0.9], 'EdgeColor','none')
Note: The patch function will close the curve on its own.
  4 件のコメント
Andrew Poissant
Andrew Poissant 2018 年 1 月 18 日
This is perfect, thank you for the help!
Star Strider
Star Strider 2018 年 1 月 18 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by