필터 지우기
필터 지우기

How to shade area between three lines?

조회 수: 12 (최근 30일)
Youngmin
Youngmin 2020년 3월 19일
댓글: Star Strider 2020년 3월 19일
Hello,
I would like to shade under the curve at which is greater than 1 in y value and greater than 20 in y value in the figure below.
But, fill function seems to allow shading the area between two vectors and not allow to use xline and/or yline functions at the same time. Please let me know how I can fill the area (upper right side area under the curve).

채택된 답변

Star Strider
Star Strider 2020년 3월 19일
편집: Star Strider 2020년 3월 19일
I believe there is an error in your description.
Try this interpretation of what I believe you intend:
x = linspace(0, 50); % Create Data
y = 6 * (exp(-(x-10).^2/25) + exp(-(x-25).^2/50)); % Create Data
Lvy = (y > 1) & (x > 20);
figure
plot(x, y)
hold on
patch([x(Lvy) fliplr(x(Lvy))], [ones(size(x(Lvy))) fliplr(y(Lvy))], 'g')
hold off
EDIT —
Added plot figure:
  댓글 수: 2
Youngmin
Youngmin 2020년 3월 19일
Thank you for the quick reply. It works very well!
Star Strider
Star Strider 2020년 3월 19일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Two y-axis에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by