Can someone please explain what I’m doing wrong?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Neither my xlabel command in line 4 is working nor the legend command
0 commentaires
Réponse acceptée
Star Strider
le 23 Jan 2024
Modifié(e) : Star Strider
le 23 Jan 2024
The semicolon in the legend call is wrong (in this context).
It would be better to write all that as a script rather than in the Command Window.
When you do that, it works —
x = -5:0.1:5;
s = sin(x);
c = cos(x);
plot(x,s, x,c)
xlabel('x')
ylabel('sine or cosine')
legend('sine','cosine')
EDIT — Corrected typographical errors.
.
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Legend dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
