how do I shade area under graph with specific x interval?

14 Ansichten (letzte 30 Tage)
a=10;
t=0:0.1:200;
c_L=0.2.*(1-exp(1).^(-1/a.*t))
plot(t,c_L)
this is my graph and I just want to shade area between t=60:0.1:200;
what function should I use?

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 29 Dez. 2020
Try something like this
a=10;
t=0:0.1:200;
c_L=0.2.*(1-exp(1).^(-1/a.*t));
t_shade = 60:0.1:200;
c_L_shade = 0.2.*(1-exp(1).^(-1/a.*t_shade));
plot(t,c_L)
hold on
patch([t_shade fliplr(t_shade)], [c_L_shade zeros(size(c_L_shade))], ...
'r', ...
'FaceAlpha', 0.2)
  2 Kommentare
Jong Hyun Lee
Jong Hyun Lee am 29 Dez. 2020
Thank you for good answer, may I ask what does "patch" command do?
Ameer Hamza
Ameer Hamza am 29 Dez. 2020
It is used to draw a polygon, given the x and y coordinates.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Image Analyst
Image Analyst am 29 Dez. 2020

Kategorien

Mehr zu Networks finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by