% Lösung DFT

fs  = 1000;
alpha   = 0:1:9;
A = [1, 1.35, 1.8, 1.9, 1.95, 1.92, 1.92, 1.94, 1.95, 1.93];
N   = length(A);

subplot(2,1,1);
stem(alpha, A);
xlabel('alpha'); ylabel('A(alpha)'); grid on;

xk = zeros(1,10);
xkabs  = zeros(1,10);

for m=0:1:9
    for n=1:1:10
        
        xk(m+1) =  xk(m+1)+ A(n) * (cos(2*pi*(n-1)*m/N) + i*sin(2*pi*n*m/N));
        end
    
    xkabs(m+1) = abs(xk(m+1))/N;
end

k = (0:1:(N-1));

subplot(2,1,2);
stem(k, xkabs);
xlabel('k'); ylabel('xkabs'); grid on;