1. 程式人生 > >Matlab一個視窗中繪製多個圖形

Matlab一個視窗中繪製多個圖形

subplot指令
將影象視窗分成若干個區域,在每個區域內分別繪圖.
handle = subplot(m, n, p);
上述指令將影象劃分為 m*n 個子區域, p用於指向子區域. 順序為
1 2 3 … n
n+1 n+2 n+3 2n
……………………………………..
(m-1)n+1 ……………………m*n

例子:

x = 0 : pi / 100: 2 * pi;
y = sin(x);
subplot(2, 2, 1), plot(x, y)
xlabel('sin(x)');
grid on

y = cos(x);
subplot(2, 2, 2), plot(x, y)
xlabel('cos(x)');
grid on
clear x = -pi/4 : pi / 100: +pi/4; y = tan(x); subplot(2, 2, 3), plot(x, y) xlabel('tan(x)'); grid on y = cot(x); subplot(2, 2, 4), plot(x, y) xlabel('cot(x)'); grid on
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

這裡寫圖片描述

end

轉載自:https://blog.csdn.net/human_recognition/article/details/51824252