필터 지우기
필터 지우기

How can I show the ranges in the graph of a function?

조회 수: 1 (최근 30일)
HUST Student
HUST Student 2015년 10월 29일
댓글: HUST Student 2015년 10월 29일
I must shou (-0,8; 0,8)
  댓글 수: 2
Walter Roberson
Walter Roberson 2015년 10월 29일
Do you mean you need to draw vertical lines at -0.8 and +0.8 ?
HUST Student
HUST Student 2015년 10월 29일
편집: HUST Student 2015년 10월 29일
I wanted to point out this interval (-0.8, 0.8) in the graph of the function changing the line texture, for example to dashed - - - -
if it is not possible point out range in this way. X can be placed at the beginning and end of the interval on the graph of the function

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

답변 (1개)

Walter Roberson
Walter Roberson 2015년 10월 29일
To change a line texture part way through a line, you need to draw a different line for each part that has a different texture. For example,
idx1 = find(x < -0.8);
idx2 = find(-0.8 <= x & x <= 0.8);
idx3 = find(0.8 < x);
idx1t = [idx1(:); idx2(1)];
idx2t = idx2;
idx3t = [idx2(:); idx3(1)];
plot( x([idx1t), y(idxt), '-');
hold on
plot(x(idx2t), y(idx2t), '--');
plot(x(idx3t), y(idx3t), '-');
The extra work with the *t variables is to allow the segments to join up.
  댓글 수: 3
HUST Student
HUST Student 2015년 10월 29일
plot( x(idx1t), y(idx1t), '-');
I correct it! I will try one more time
HUST Student
HUST Student 2015년 10월 29일
Thank you!!!!! It worked!!!!

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

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by