作业帮 > 综合 > 作业

matlab上有什么方法可以调整legend的顺序

来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/04/26 18:41:14
matlab上有什么方法可以调整legend的顺序
matlab上有什么方法可以调整legend的顺序
思路:修改图形对应函数的顺序,来改legend顺序.
以y1=cos(t),y2=sin(t)为例,进行说明如下:t=linspace(1,20,1000);y1=cos(t);y2=sin(t);plot(t,y1,t,y2,'r');legend('cos(t)','sin(t)');结果
修改后,t=linspace(1,20,1000);y1=cos(t);y2=sin(t);plot(t,y2,t,y1,'r');legend('sin(t)','cos(t)');
希望对你有帮助,欢迎交流!