###################################

一:合並繪圖:
plot(X1,Y1,LineSpec1,...,Xn,Yn,LineSpecn)
x = linspace(-2*pi,2*pi,200); y1 = sin(x); y2 = cos(x);
plot(x,y1,'-k',x,y2,'--k');
%標題: title('Plot');
%坐標 xlabel('x'); ylabel('cos(x) sin(x)');
%圖例
legend('y=sin(x)','y=cos(x)')
二:子圖:subplot(m,n,p)表示整個圖一共有m行,每行放n個圖片,從左到右從上到下的第p個圖片:
上下兩個圖:
subplot(2,1,1); x = linspace(0,10); y1 = sin(x); plot(x,y1) subplot(2,1,2); y2 = sin(5*x); plot(x,y2)

四個圖:
subplot(2,2,1) x = linspace(0,10); y1 = sin(x); plot(x,y1) title('Subplot 1: sin(x)') subplot(2,2,2) y2 = sin(2*x); plot(x,y2) title('Subplot 2: sin(2x)') subplot(2,2,3) y3 = sin(4*x); plot(x,y3) title('Subplot 3: sin(4x)') subplot(2,2,4) y4 = sin(8*x); plot(x,y4) title('Subplot 4: sin(8x)')

三個圖:
創建一個包含三個子圖的圖窗。在圖窗的上半部分創建兩個子圖,並在圖窗的下半部分創建第三個子圖。在每個子圖上添加標題。 subplot(2,2,1); x = linspace(-3.8,3.8); y_cos = cos(x); plot(x,y_cos); title('Subplot 1: Cosine') subplot(2,2,2); y_poly = 1 - x.^2./2 + x.^4./24; plot(x,y_poly,'g'); title('Subplot 2: Polynomial') subplot(2,2,[3,4]); plot(x,y_cos,'b',x,y_poly,'g'); title('Subplot 3 and 4: Both')

三個圖:

圖像修飾:線型標記顏色:

##############################
