Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Is it possible to create a legend on a graph which is reliant on the function input?
3 ビュー (過去 30 日間)
古いコメントを表示
I am graphing a function, and I want the legend on the graph to post what the input of the function is...
0 件のコメント
回答 (2 件)
KSSV
2017 年 11 月 3 日
x = linspace(0,2*pi) ;
f1 = @(x) sin(x) ;
f2 = @(x) x.^2 ;
y1 = f1(x) ;
y2 = f2(x) ;
figure
hold on
plot(x,y1,'r')
plot(x,y2,'b')
legend('sin(x)','x^2')
0 件のコメント
Walter Roberson
2017 年 11 月 3 日
Yes but it would not often be readable.
For a function with input in the variable x you can do
legend( num2str(x))
However the user could just look at the plot to see what the range of the values were?
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!