Here is a demonstration of how to create three (or an arbitrary number of) plots vertically joined together:
X = 0:0.1:8;
Y(:,3) = sin(X);
Y(:,2) = cos(X);
Y(:,1) = X.^2;
N = size(Y,2);
H = NaN(1,N);
figure()
for k = 1:N
H(k) = subplot(N,1,k);
plot(X,Y(:,k));
end
set(H(2:N),'XTickLabel',{''})
pos = cell2mat(get(H,'Position'));
ymx = pos(1,2)+pos(1,4);
ymn = pos(end,2);
hgt = (ymx-ymn)/N;
pos(:,4) = hgt;
pos(:,2) = pos(end,2) + hgt*(0:N-1);
set(H,{'Position'}, num2cell(pos,2));
You will also have to consider the YtickLabel or tick marks, as these overlap in this example. It produces this figure:
Best Answer