Shade the region above the graph
7 views (last 30 days)
Show older comments
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')
0 Comments
Answers (1)
Star Strider
on 21 Sep 2020
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 Comments
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!