# Partial column approximation error

Can someone help me understanf how to plot the next partial column in MATLAB:

while N=2001

|M|<700

ak =

• actually, im trying to watch a 4 hours video just to understand the right syntax. i just need example to understand it well Apr 25 '20 at 15:20
• If you can make a vector with all the terms under the sum, you are almost there Apr 25 '20 at 15:22
• N=2001; n=-700:1:700; w0=2*pi/N; base=(n')*n; hezka=1jw0*base; PosExp=exp(hezka); ak=((sin((199*pi/N)*n))./(N.*(sin((pi/N)*n)))); am=(1/N)*(akPosExp); Apr 25 '20 at 15:28
• thats how i defined the vector. but i dont know how to plot it :( Apr 25 '20 at 15:32
• I think there is a mistake in your code. But a plot(am) or plot(real(am)) when am is computed should work Apr 25 '20 at 15:38

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.)');