필터 지우기
필터 지우기

Fill background area between two x values in a graph

조회 수: 35 (최근 30일)
leonidas86
leonidas86 2018년 6월 7일
편집: Aquatris 2020년 11월 21일
Hello,
How can I fill a specified background area between two x values?

답변 (1개)

Aquatris
Aquatris 2018년 6월 8일
A simple and quick way is to fill a rectangle before you start your plot.
x1 = 0.4; x2 = 0.9;
y1 = 1; y2 = -1;
figure(1)
fill([x1 x1 x2 x2],[y1 y2 y2 y1],'r')
axis([0 2 y2 y1]),hold on
t = 0:1e-3:2*pi;
plot(t,sin(10*t))
  댓글 수: 2
Carlee Toddes
Carlee Toddes 2020년 11월 20일
if you have multiple x values that need to be patched (i.e.several sets of two data points that need to be discretely patched on a time scale) is there a function that can help with this
Aquatris
Aquatris 2020년 11월 21일
편집: Aquatris 2020년 11월 21일
Does the patch function not work for you? Here is the link.

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

카테고리

Help CenterFile Exchange에서 Polygons에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by