# Figure 7.2

## GUIDE: Mathematics of the Discrete Fourier Transform (DFT) - Julius O. Smith III. Figure 7.2

It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements. If you like it please feel free to a small amount of money to secure the future of this website.

NOTE: THIS DOCUMENT IS OBSOLETE, PLEASE CHECK THE NEW VERSION: "Mathematics of the Discrete Fourier Transform (DFT), with Audio Applications --- Second Edition", by Julius O. Smith III, W3K Publishing, 2007, ISBN 978-0-9745607-4-8. - Copyright © 2017-09-28 by Julius O. Smith III - Center for Computer Research in Music and Acoustics (CCRMA), Stanford University

<< Previous page  TOC  INDEX  Next page >>

## Figure 7.2

Below is the Matlab for Fig. 7.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```

<< Previous page  TOC  INDEX  Next page >>