Filter löschen
Filter löschen

How can I give legend to a plot as a series?

2 Ansichten (letzte 30 Tage)
kanyvt
kanyvt am 8 Apr. 2015
Kommentiert: Kelly Kearney am 9 Apr. 2015
Suppose I have multiple graphs on a plot for a parameter varying from -4 to 0.25 with difference of 0.25 between adjacent values (which is about 18 in number)? Can I say like legend y. where y is a variable varying from -4 to 0.25?

Akzeptierte Antwort

Kelly Kearney
Kelly Kearney am 8 Apr. 2015
Example data:
x = 1:10;
h = plot(x, x'*p)
Create legend:
legend(h, cellstr(num2str(p', '%.2f')));
  3 Kommentare
kanyvt
kanyvt am 9 Apr. 2015
Could you please tell me what is p here?
Kelly Kearney
Kelly Kearney am 9 Apr. 2015
Sorry, p was the parameter:
p = -4.0:0.25:0.25;

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by