Highlight Region of Sine Graph

조회 수: 7(최근 30일)
birdnerd007
birdnerd007 2020년 10월 16일
편집: birdnerd007 2020년 10월 16일
I have a sine graph and I want to highlight all along the x-axis and just the [-1,1] region on the y-axis. Is this possible?
This is my code and I would like the bounds between [-1,1] on the y-axis to be shaded some color all along the x-axis. The whole area, not just the peaks and valleys.

채택된 답변

Asad (Mehrzad)  Khoddam
Asad (Mehrzad) Khoddam 2020년 10월 16일
% Do you want this?
x=linspace(0,2*pi,101);
y=sin(x);
area(x,y)
  댓글 수: 5
birdnerd007
birdnerd007 2020년 10월 16일
Amazing! Thank you!

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

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by