fs = 1000;
k  = 0:1:9;
X  = [1,2-i,-1+i,-2-i,2+i,1,2+i,-2-i,-1+i,2-i];
N  = length(X);

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

yk = zeros(1,10);
ykabs  = zeros(1,10);

for m=0:1:9
    for k=0:1:9
        
        yk(m+1) =  yk(m+1) + X(k+1) * (cos(2*pi*k*m/N) + i*sin(2*pi*k*m/N));
        end
    
    ykabs(m+1) = yk(m+1)/N;
end

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

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