The legend of the plot doesn't appear
3 次查看(过去 30 天)
显示 更早的评论
Hi,
I want to plot a signal with a title and legend. But the legend doesn't appear on the plot, wheareas the title do.
Can someone help me please ?
0 个评论
回答(2 个)
Image Analyst
2020-7-8
编辑:Image Analyst
2020-7-8
Works for me:
t = 20;
ech = 0.001;
k = 1;
for i = 0:ech:t
y(k,:) = [i 3+sin(4*i)/5+cos(8*i)/9];
k = k + 1;
end
plot(y(:,1),y(:,2));
legend("signal");
Except that I don't get a title on my plot using your very same code. I don't see how you got a title instead of a legend. Are you sure you're not confusing the legend (inside the box inside the plot) with a title?
Try, in the command window:
>> restoredefaultpath
and try again.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!