www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/OptimizeFFTwithPaddingExample.m
%% Optimize FFT with Padding % Use the |nextpow2| function to increase the performance of |fft| when the length of % a signal is not a power of 2. %% % Create a 1-D vector containing 8191 sample values. x = gallery('uniformdata',[1,8191],0); %% % Calculate the next power of 2 higher than 8191. p = nextpow2(8191); n = 2^p %% % Pass the signal and the next power of 2 to the |fft| function. y = fft(x,n);