matlab 合并绘图,如何加图例?

用语句 legend('-DynamicLegend') 和 hold all ,请看下面的例子:

1
2
3
4
5
x=0:.01:10;
plot(x, sin(x), 'DisplayName','sin');
legend('-DynamicLegend');
hold all; % add new plot lines on top of previous ones
plot(x, cos(x), 'DisplayName','cos');

标签: matlab

添加新评论

captcha
请输入验证码