how to mention function on plot?
조회 수: 2 (최근 30일)
이전 댓글 표시
x=-pi:pi
y1=sin(x)
y2=cos(x)
plot(x,y1,x,y2)
how can we mention sin and cosine function on plot?
댓글 수: 0
채택된 답변
Star Strider
2015년 10월 11일
One option is to use the legend function:
x=-pi:0.1:pi;
y1=sin(x);
y2=cos(x);
plot(x,y1,x,y2)
legend('sin(x)', 'cos(x)', 'Location','NW')
There are other options using the text function if you want to display different text labels.
댓글 수: 3
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!