How can I show the ranges in the graph of a function?
조회 수: 3 (최근 30일)
이전 댓글 표시
I must shou (-0,8; 0,8)
댓글 수: 2
답변 (1개)
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!