I am trying to omit the legend entry for graph b, but the following code still shows the curve in the legend. Thanks!
a = @(x) sin(x)
fplot (a,[1,10])
hold on
b = @(x) cos (x)
fplot (b,[1,10])
c = @(x) tan (x)
fplot (c,[1,10])
legend ('sinx','','tanx')

 採用された回答

Star Strider
Star Strider 2015 年 9 月 14 日

4 投票

The fplot function won’t let you do that, but plot will:
x = linspace(1,10);
a = @(x) sin(x);
ha = plot (x,a(x));
hold on
b = @(x) cos (x);
hb = plot (x,b(x));
c = @(x) tan (x);
hc = plot (x,c(x));
legend ([ha hc],'sinx','tanx')

2 件のコメント

victoria yap
victoria yap 2015 年 9 月 15 日
Thanks Star Strider! Works! :)
Star Strider
Star Strider 2015 年 9 月 15 日
My pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by