02.10.2019 Views

UploadFile_6417

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

196 Chapter 5 THE DISCRETE FOURIER TRANSFORM<br />

compute their FFTs, and save the computation time in an array. Finally, we<br />

will plot this execution time versus N.<br />

MATLAB script:<br />

>> Nmax = 2048; fft_time=zeros(1,Nmax);<br />

>> for n=1:1:Nmax<br />

>> x=rand(1,n);<br />

>> t=clock;fft(x);fft_time(n)=etime(clock,t);<br />

>> end<br />

>> n=[1:1:Nmax]; plot(n,fft_time,’.’)<br />

>> xlabel(’N’);ylabel(’Time in Sec.’) title(’FFT execution times’)<br />

The plot of the execution times is shown in Figure 5.21. This plot is very<br />

informative. The points in the plot do not show one clear function but appear<br />

to group themselves into various trends. The uppermost group depicts a o(N 2 )<br />

dependence on N, which means that these values must be prime numbers between<br />

1 and 2048 for which the FFT algorithm defaults to the DFT algorithm.<br />

Similarly, there are groups corresponding to the o ( N 2 /2 ) , o ( N 2 /3 ) , o ( N 2 /4 ) ,<br />

and so on, dependencies for which the number N has fewer decompositions.<br />

The last group shows the (almost linear) o (N log N) dependence, which is for<br />

50<br />

FFT execution times<br />

45<br />

o(N*N)<br />

40<br />

35<br />

Time in Sec.<br />

30<br />

25<br />

20<br />

o(N*N/2)<br />

15<br />

10<br />

o(N*N/4)<br />

5<br />

o(N*logN)<br />

0<br />

0 500 1000 1500 2000 2500<br />

N<br />

FIGURE 5.21 FFT execution times for 1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!