%using for loops with subplot
clc
clf
x = linspace(0,2*pi); %default 100 pts
for n=1:9
subplot(3,3,n);
y = cos(n*x);
plot(x,y,'LineWidth',2);
xlabel('x');
ylabel('y');
str =['subplot ',num2str(n)];
title(str);
axis tight
end