difft
- Provides accurate harmonic extraction for signals with unknown fundamental frequency.
- Works well on microcontrollers with limited memory, such as STM32 and TMS320.
- Uses fast FFT libraries that take advantage of hardware acceleration.
- It estimates the actual fundamental frequency using Gaussian interpolation.
- It resamples the signal using sample rate conversion so that harmonic frequencies align properly with FFT bins.
- It performs a second FFT to extract accurate amplitude and phase information.
- Less than 1% error for harmonics up to the 11th order.
- Runs 3 to 5 times faster on STM32F4 than previous methods.
- Uses less than 100 kilobytes of RAM for 8K samples
Cite As
Gus Zhang (2025). difft (https://github.com/guszhang/difft/releases/tag/v0.1.1), GitHub. Retrieved .
Tian, Yidong, and Cheng Zhang. “An Improved Accuracy Harmonic Extraction Method for Microcontrollers.” IEEE Transactions on Industrial Electronics, vol. 72, no. 5, May 2025, pp. 5344–52, https://doi.org/10.1109/tie.2024.3472288.
M. Gasior, J. L. Gonzalez, “Improving FFT Frequency Measurement Resolution by Parabolic and Gaussian Spectrum Interpolation,” AIP Conference Proceedings, vol. 732, no. 1, pp. 276–285, Nov. 2004.
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
matlab/examples
matlab/src
| Version | Published | Release Notes | |
|---|---|---|---|
| 0.1.1 | See release notes for this release on GitHub: https://github.com/guszhang/difft/releases/tag/v0.1.1 |
||
| 0.1.0 |
