號令行鍵入:
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 來添加一個具有兩列的圖例。
 END0 篇文章
如果覺得我的文章對您有用,請隨意打賞。你的支持將鼓勵我繼續創作!