File Exchange

image thumbnail

autofft - FFT analyzer

version 1.2.5 (5.94 KB) by Lubos Smolik
Frequency analyser useful for interpretation of experimental data or a comparison of theoretical results with measurements.

20 Downloads

Updated 10 Jun 2020

View License

Signal Processing Toolbox™ provides several functions to power spectrum estimation, including pspectrum and stft. Although these functions are excellent and well-documented, they might be cumbersome in some engineering applications. These applications include estimating magnitudes of vibration, noise and other discrete-time signals in engineering units or a comparison of theoretical results with measurements.

In such applications, you can use autofft, a Matlab function for estimation of the discrete Fourier transform (DFT) which mimics options of the Brüel & Kjaer FFT analysers. Based on your input, autoFFT segments signal, applies window functions and spectral averaging. The resulting DFT can be returned in various engineering spectral units including magnitude, RMS, peak-to-peak and power spectral density (PSD). autofft can also estimate spectral derivation or spectral integral of DFT and even perform the short-time Fourier transform (STFT).

Note that autoFFT requires the Signal Processing Toolbox in order to generate window functions and estimate PSD accurately.

If you have any suggestions and comments or if you want to report a bug, feel free to contact me via e-mail carlist(at)ntis.zcu.cz.

Cite As

Lubos Smolik (2020). autofft - FFT analyzer (https://www.mathworks.com/matlabcentral/fileexchange/69534-autofft-fft-analyzer), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)

Thales

Lubos Smolik

@Attskij Sotona

fftset = struct('nwin', nfft, ... % Specifies the number of DFT points
'unit', 'psd'); % Specifies the spectral unit
[s, freq] = autfft(x, fs, fftset);

Note that if If nfft is less than the signal length, autofft behaves differently than periodogram because autofft averages result in the frequency domain rather than time domain.

For example, the input signal [1 2 3 4 5 6 7 8] with nfft equal to 4 results in the periodogram of sum([1 5; 2 6; 3 7; 4 8],2). However, it results in the averaged power spectral density from segments [1 2 3 4], [3 4 5 6], [5 6 7 8] in the case of autofft. The overlapping percentage of individual segments can be controlled with 'overlap' parameter.

Thanks for sharing, looks great!
One question please. What's params for this function to get an equivalent of "periodogram(x, [], nfft, fs, 'psd', 'onesided');" ?

Updates

1.2.5

An optional highpass filtering has been implemented.

1.2.4.2

Overlap length (in samples) returned in output variable setup is now correct. Previous versions incorrectly returned overlap percentage.

1.2.4.1

An error occurring during estimation of autospectrum has been fixed.

1.2.4

- Improved documentation.
- New types of averaging: median filter and variance of spectral unit.
- Results of the STFT of multiple signals are now returned as 3D array.
- Performance improved significantly.
- Accuracy of PSD slightly improved.

1.2.3

- User can define frequency resolution of the analyser.
- The window function can be directly specified as a vector.
- The analyser setup can be returned as an output variable.
- Warning messages are now displayed.

MATLAB Release Compatibility
Created with R2020a
Compatible with R2013a to R2020a
Platform Compatibility
Windows macOS Linux