フィルターのクリア

How to fill space between two lines?

7 ビュー (過去 30 日間)
Lukasz Skowron
Lukasz Skowron 2019 年 1 月 17 日
コメント済み: Star Strider 2019 年 1 月 17 日
Hi, I have this code:
H_up = [0,cosd(80)*7.387/10,cosd(70)*7.985/10,cosd(60)*8.906/10,cosd(50)*1.025,cosd(40)*1.238,cosd(30)*1.155,cosd(20)*1.064,cosd(10)*1.015,1];
H_lo = [0,cosd(80)*7.243/10,cosd(70)*7.826/10,cosd(60)*8.734/10,cosd(50)*1.009,cosd(40)*1.218,cosd(30)*1.137,cosd(20)*1.062,cosd(10)*1.015,1];
M_up = [7.021/10,sind(80)*7.387/10,sind(70)*7.985/10,sind(60)*8.906/10,sind(50)*1.025,sind(40)*1.238,sind(30)*1.155,sind(20)*1.064,sind(10)*1.015,0];
M_lo = [6.897/10,sind(80)*7.243/10,sind(70)*7.826/10,sind(60)*8.734/10,sind(50)*1.009,sind(40)*1.218,sind(30)*1.137,sind(20)*1.062,sind(10)*1.015,0];
plot(H_up,M_up)
hold on
plot(H_lo,M_lo)
I would like to fill space between those lines with some color, say light-blue. How to do that?
Thanks,
Lukasz

採用された回答

Star Strider
Star Strider 2019 年 1 月 17 日
Try this:
H_up = [0,cosd(80)*7.387/10,cosd(70)*7.985/10,cosd(60)*8.906/10,cosd(50)*1.025,cosd(40)*1.238,cosd(30)*1.155,cosd(20)*1.064,cosd(10)*1.015,1];
H_lo = [0,cosd(80)*7.243/10,cosd(70)*7.826/10,cosd(60)*8.734/10,cosd(50)*1.009,cosd(40)*1.218,cosd(30)*1.137,cosd(20)*1.062,cosd(10)*1.015,1];
M_up = [7.021/10,sind(80)*7.387/10,sind(70)*7.985/10,sind(60)*8.906/10,sind(50)*1.025,sind(40)*1.238,sind(30)*1.155,sind(20)*1.064,sind(10)*1.015,0];
M_lo = [6.897/10,sind(80)*7.243/10,sind(70)*7.826/10,sind(60)*8.734/10,sind(50)*1.009,sind(40)*1.218,sind(30)*1.137,sind(20)*1.062,sind(10)*1.015,0];
plot(H_up,M_up)
hold on
plot(H_lo,M_lo)
patch([H_up fliplr(H_lo)], [M_up fliplr(M_lo)], [0.6 0.8 1.0])
hold off
See the documentation on the patch (link) function to understand how it works.
  2 件のコメント
Lukasz Skowron
Lukasz Skowron 2019 年 1 月 17 日
Thanks, it does exactly what I wanted!
Star Strider
Star Strider 2019 年 1 月 17 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by