Can someone please explain what I’m doing wrong?
3 次查看(过去 30 天)
显示 更早的评论
Neither my xlabel command in line 4 is working nor the legend command
0 个评论
采纳的回答
Star Strider
2024-1-23
编辑:Star Strider
2024-1-23
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.
.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
