N = 20; n = [0:1:N-1]; M = 8; w = [0.0, .1, .2, .8, .9, 1.0, 1.1, 1.2]; x = []; for i=1:1:M, w0 = w(i)*pi; x(i,:) = cos(w0*n); end figure; for i=1:1:8, tit = sprintf('x(n) = cos(%1.1f*pi)', w(i)); subplot(4, 2, i); %plot(n, x(i,:)); stem(n, x(i,:)); xlabel('n'); ylabel('x(n)'); title(tit); end