Another reason we zero-pad is to be able to use a Cooley-Tukey FFT with any
window length
. When
is not a power of
, we append enough
zeros to make the FFT size
be a power of
. In Matlab and
Octave, the function nextpow2 returns the next higher power
of 2 greater than or equal to its argument:
N = 2^nextpow2(M); % smallest M-compatible FFT size