DFT Sinusoids for Next  |  Prev  |  Up  |  Top  |  Index  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search


DFT Sinusoids for $ N=8$

Below is the Matlab for Fig.6.2:

N=8;
fs=1;

n = [0:N-1]; % row
t = [0:0.01:N]; % interpolated
k=fliplr(n)' - N/2;
fk = k*fs/N;
wk = 2*pi*fk;
clf;
for i=1:N
  subplot(N,2,2*i-1);
  plot(t,cos(wk(i)*t))
  axis([0,8,-1,1]);
  hold on;
  plot(n,cos(wk(i)*n),'*')
  if i==1
    title('Real Part');
  end;
  ylabel(sprintf('k=%d',k(i)));
  if i==N
    xlabel('Time (samples)');
  end;
  subplot(N,2,2*i);
  plot(t,sin(wk(i)*t))
  axis([0,8,-1,1]);
  hold on;
  plot(n,sin(wk(i)*n),'*')
  ylabel(sprintf('k=%d',k(i)));
  if i==1
    title('Imaginary Part');
  end;
  if i==N
    xlabel('Time (samples)');
  end;
end


Next  |  Prev  |  Up  |  Top  |  Index  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

[How to cite this work] [Order a printed hardcopy]

``Mathematics of the Discrete Fourier Transform (DFT), with Music and Audio Applications'', by Julius O. Smith III, W3K Publishing, 2003, ISBN 0-9745607-0-7.
Copyright © 2007-02-02 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA  [Automatic-links disclaimer]