update with FFT duration code
This commit is contained in:
parent
2b37fae0a1
commit
165f7c6d98
|
|
@ -0,0 +1,28 @@
|
||||||
|
function duration = computeFFTDuration(x, fs, pad)
|
||||||
|
%%%%%%%%%%%%%%%%%%
|
||||||
|
%function duration = computeFFTDuration(x, fs, pad)
|
||||||
|
%
|
||||||
|
% Task: Determine the duration of a DFT/FFT
|
||||||
|
%
|
||||||
|
% Input:
|
||||||
|
% - signal: the input signal to process
|
||||||
|
% - fs: the sampling rate
|
||||||
|
% - pad: boolean if true, signal is padded to the next power of 2 otherwise the dft is computed on the signal length
|
||||||
|
%
|
||||||
|
% Output:
|
||||||
|
% - duration: duration of the computation process for the DFT/FFT
|
||||||
|
%
|
||||||
|
%
|
||||||
|
% Guillaume Gibert, guillaume.gibert@ecam.fr
|
||||||
|
% 27/04/2022
|
||||||
|
%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
n = length(x);
|
||||||
|
|
||||||
|
if (pad)
|
||||||
|
n = 2^nextpow2(n);
|
||||||
|
end
|
||||||
|
|
||||||
|
tic
|
||||||
|
y = fft(x, n);
|
||||||
|
duration = toc;
|
||||||
Loading…
Reference in New Issue