Examples
Comparison of Speed for Different Planner Methods
The following example illustrates the run times for different settings of planner. The example first creates some data and appliesfft to it using the default method, estimate.
t=0:.001:5;
x = sin(2*pi*50*t)+sin(2*pi*120*t);
y = x + 2*randn(size(t));
tic; Y = fft(y,1458); toc
Elapsed time is 0.000521 seconds.
If you execute the commands
tic; Y = fft(y,1458); toc
Elapsed time is 0.000151 seconds.
a second time, MATLAB software reports the elapsed time as essentially 0. To measure the elapsed time more accurately, you can execute the command Y = fft(y,1458) 1000 times in a loop.
tic; for k=1:1000
Y = fft(y,1458);
end; toc
Elapsed time is 0.056532 seconds.
This tells you that it takes on order of 1/10000 of a second to execute fft(y, 1458) a single time.
For comparison, set planner to patient. Since this planner explores possible algorithms more thoroughly than hybrid, the first time you run fft, it takes longer to compute the results.
fftw('planner','patient')
tic;Y = fft(y,1458);toc
Elapsed time is 0.100637 seconds.
However, the next time you call fft, it runs at approximately the same speed as before you ran the method patient.
tic;for k=1:1000
Y=fft(y,1458);
end;toc
Elapsed time is 0.057209 seconds.
Reusing Optimal FFT Algorithms
In order to use the optimized FFT algorithm in a future MATLAB session, first save the "wisdom" using the command
str = fftw('wisdom')
You can save str for a future session using the command
save str
The next time you open a MATLAB session, load str using the command
load str
and then reload the "wisdom" into the FFTW database using the command
fftw('wisdom', str)