Following is the code I've written which involves a subplot
command inside a for loop. I want each subplot
to have the same y-axis limits, say 0 to 15. But the three plots have different (adjusted) y-axis limits which defeats the very purpose of comparing the three plots. How do I maintain same ylimits in all three subplots?
w = -pi:0.001:pi;
N = [8 10 14];
for i = 1:3
subplot(3, 1, i);
W = exp(-1i*w*(N(i)-1)/2).*sin(w*N(i)/2)./sin(w/2);
plot(w, abs(W));
xlabel('\omega'); ylabel('Magnitude');
title(sprintf('N = %d', N(i)));
end