% 6.003 Problem Set 3, Problem 3
% WonRon Cho (leopardi)
% Nada Amin (namin)

N = 6;
y = [-1 0 1 -1 2 2]
k = [0:N-1];
n = [0:N-1];
% find the fourier series of y[n] (b_0 to b_7)
b = zeros(1,N);
for k=0:N-1,
  b(k+1) = (1/N)*sum(y .* (cos(-2*pi*k*n/N) + j*sin(-2*pi*k*n/N)));
end

b
abs(b)
angle(b)
