subplot(3,2,1);
stem(n,x) ; %X(n) input signal
xlabel('n');
ylabel('Amplitude');
title('Problem #1A: X(n)');
grid on

subplot(3,2,3);
plot(w,magX) ; %Magnitude plot of x(n)
xlabel('\omega');
ylabel('Amplitude');
title('Magnitude spectrum of X(n)');
grid on
axis([0,pi,0,8]);

subplot(3,2,5);
plot(w,phaseX) ; %Phase plot of x(n)
xlabel('\omega');
ylabel('Radians');
title('Phase spectrum of X(n)');
grid on
axis([0,pi,-3,2]);