0
$\begingroup$

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

enter image description here

while N=2001

|M|<700

ak =

enter image description here

$\endgroup$
  • $\begingroup$ actually, im trying to watch a 4 hours video just to understand the right syntax. i just need example to understand it well $\endgroup$ – Omer Dahan Apr 25 at 15:20
  • $\begingroup$ If you can make a vector with all the terms under the sum, you are almost there $\endgroup$ – Laurent Duval Apr 25 at 15:22
  • $\begingroup$ 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); $\endgroup$ – Omer Dahan Apr 25 at 15:28
  • $\begingroup$ thats how i defined the vector. but i dont know how to plot it :( $\endgroup$ – Omer Dahan Apr 25 at 15:32
  • $\begingroup$ I think there is a mistake in your code. But a plot(am)` or plot(real(am))` when am is computed should work $\endgroup$ – Laurent Duval Apr 25 at 15:38
0
$\begingroup$
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.)');

enter image description here

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.