Partial column approximation error
N = 2001;
M = 600 ;
vectorOfK = (-M:M)';

vectorOfN = (0:N-1);
%%% For a given n
% n  = 314;

vectorOfAk = sin(199*pi*vectorOfK/2001)./(2001*sin(pi*vectorOfK/2001));
% Modify the NaN value (0/0 division) at k = 0; 
vectorOfAk(M+1) = 199/2001;

matrixOfExpo = exp(1i*2*pi/N*(vectorOfK*vectorOfN));
matrixOfAkExpoProduct = repmat(vectorOfAk,1,N).*matrixOfExpo;

vectorOfATilde = sum(matrixOfAkExpoProduct)/N;

subplot(2,1,1)
plot(vectorOfN,real(vectorOfATilde));
xlabel('Real part (index)');xlabel('Amplitude (a. u.)');

subplot(2,1,2)
plot(vectorOfN,imag(vectorOfATilde));
xlabel('Imaginary part (index)');xlabel('Amplitude (a. u.)');