Shade the region above the graph

10 ビュー (過去 30 日間)
Sasha Gomes
Sasha Gomes 2020 年 9 月 21 日
コメント済み: Star Strider 2020 年 9 月 21 日
I am trying to shade the region to above the graph. Does anyone know how to go about doing that? It would be a great help.
Thanks
My code is attached below
% Maximum speed
rho = 0.002378; % at sea level
Vmax = 987.48;
K = 0.0397887;
rho30 = 0.00089;
rhos = 0.374; % sigma
WS = 0:0.1:160;
TWvmax = ((1.23488./WS)+(0.000414*WS));
plot(WS,TWvmax,'--r')
hold on
text(60,-0.01,'Maximum speed')

回答 (1 件)

Star Strider
Star Strider 2020 年 9 月 21 日
Try this:
% Maximum speed
rho = 0.002378; % at sea level
Vmax = 987.48;
K = 0.0397887;
rho30 = 0.00089;
rhos = 0.374; % sigma
WS = 0:0.1:160;
TWvmax = ((1.23488./WS)+(0.000414*WS));
plot(WS,TWvmax,'--r')
hold on
ixf = isfinite(TWvmax);
patch([WS(ixf) fliplr(WS(ixf))], [TWvmax(ixf) ones(size(TWvmax(ixf)))*max(TWvmax(ixf))], 'b', 'EdgeColor','none', 'FaceAlpha',0.5)
hold off
text(60,-0.01,'Maximum speed')
ylim([-1 max(ylim)])
Note that ‘TWvmax’ contains at least one infinite value, so it is necessasry to eliminate it to draw the patch object.
.
  3 件のコメント
Star Strider
Star Strider 2020 年 9 月 21 日
My pleasure!
Star Strider
Star Strider 2020 年 9 月 21 日
If my Answer helped you solve your problem, please Accept it!
.

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by