其他分享
首页 > 其他分享> > matlab的figure添加图例

matlab的figure添加图例

作者:互联网

 

 

x = linspace(0,pi);
y1 = cos(x);
plot(x,y1)

hold on
y2 = cos(2*x);
plot(x,y2)

y3 = cos(3*x);
plot(x,y3)

y4 = cos(4*x);
plot(x,y4)
hold off

legend({'cos(x)','cos(2x)','cos(3x)','cos(4x)'},'Location','northwest','NumColumns',2)

 

 https://www.mathworks.com/help/matlab/ref/legend.html

标签:plot,cos,figure,图例,matlab,y1,y3,y2,y4
来源: https://www.cnblogs.com/yibeimingyue/p/13418990.html