Azzera filtri
Azzera filtri

how to mention function on plot?

2 visualizzazioni (ultimi 30 giorni)
rising falcon
rising falcon il 11 Ott 2015
Commentato: Star Strider il 12 Ott 2015
x=-pi:pi
y1=sin(x)
y2=cos(x)
plot(x,y1,x,y2)
how can we mention sin and cosine function on plot?

Risposta accettata

Star Strider
Star Strider il 11 Ott 2015
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 Commenti
rising falcon
rising falcon il 12 Ott 2015
thank you.this is helpfull answer
Star Strider
Star Strider il 12 Ott 2015
My pleasure.

Accedi per commentare.

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by