N=16 % or 8
n=[0:N-1]'

x1=cos(2*pi*n/N)
figure(1),bar(n,x1);axis tight
X1=fft(x1)
k = [0:N-1]'
fk = k/N
figure(2);bar(k,X1);axis tight
figure(2);bar(k,real(X1));axis tight

x2 = [1 zeros(1,N-1)].'
figure(3),bar(n,x2);axis tight
X2 = fft(x2)
figure(4),bar(k,real(X2));axis tight

x3=sin(2*pi*n/N)
figure(5),bar(n,x3);axis tight
X3=fft(x3)
figure(6);bar(k,real(X3));axis tight
figure(6);bar(k,imag(X3));axis tight
figure(7);bar(k,X3);axis tight
figure(7);bar(X3);axis tight
figure(7);plot(X3);axis tight

x4 = randn(size(n))
figure(7),bar(n,x4);axis tight
X4=fft(x4)
figure(8);bar(k,real(X4));axis tight
figure(8);bar(k,imag(X4));axis tight
figure(8);bar(k,abs(X4));axis tight
figure(9);bar(k,angle(X4));axis tight;ylabel('phase (radians)')
figure(9);bar(k,angle(X4)*360/(2*pi));axis tight;ylabel('phase (degrees)')
figure(9);bar(k,angle(X4)/(2*pi));axis tight;ylabel('phase (cycles)')

x5 = [0 1 zeros(1,N-2)].'
figure(10),bar(n,x5);axis tight
X5 = fft(x5)
figure(11),bar(k,real(X5));axis tight
figure(11),bar(k,imag(X5));axis tight
figure(11),bar(k,abs(X5));axis tight
figure(12),bar(k,angle(X5));axis tight;ylabel('phase (radians)')
figure(12),bar(k,unwrap(angle(X5)));axis tight;ylabel('phase (radians)')
figure(12),bar(k,unwrap(angle(X5))*360/(2*pi));axis tight;ylabel('phase (degrees)')
figure(13),bar(k,unwrap(angle(X5)*360/(2*pi)));axis tight;ylabel('phase (degrees)') %terrible!
figure(12),bar(k,unwrap(angle(X5))/(2*pi));axis tight;ylabel('phase (cycles)')
