号令行键入:
x = linspace(0,10);
%界说x。
号令行键入:
y1 = sin(x);
y2 = sin(0.9*x);
y3 = sin(0.8*x);
y4 = sin(0.7*x);
y5 = sin(0.6*x);
y6 = sin(0.5*x);
%界说y1,y2,y3,y4,y5,y6。
号令行键入:
plot(x,y1,'DisplayName','sin(x)')
%绘图。
号令行键入:
hold on
%图形连结。
号令行键入:
plot(x,y2,'DisplayName','sin(0.9x)')
plot(x,y3,'DisplayName','sin(0.8x)')
plot(x,y4,'DisplayName','sin(0.7x)')
plot(x,y5,'DisplayName','sin(0.6x)')
plot(x,y6,'DisplayName','sin(0.5x)')
%绘图。
号令行键入:
hold off
%打消连结
号令行键入:
lgd = legend;
%标签。
号令行键入:
lgd.NumColumns = 2;
%经由过程将 NumColumns 属性设置为 2 来添加一个具有两列的图例。
0 篇文章
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!