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')

 Réponse acceptée

Star Strider
Star Strider le 14 Sep 2015

4 votes

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 commentaires

victoria yap
victoria yap le 15 Sep 2015
Thanks Star Strider! Works! :)
Star Strider
Star Strider le 15 Sep 2015
My pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by