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?

采纳的回答

Star Strider
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 个评论
rising falcon
rising falcon 2015-10-12
thank you.this is helpfull answer

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by