Fast Fourier Transform & Spectral Analysis

This month, I took a lecture from Coursera, Introduction to Embedded Machine Learning. In this course, we use the Arduino board to train audio and motion data. This is the first time I dealt with audio & vibration analysis. As you guess, the critical part of the training model is feature extraction. Thanks to edge impulse, I didn't need to deal with feature extraction during the project, since it analyses the data automatically and chooses the right data for the model. However, I don't want to use data that I have no idea about, therefore, I've searched fast Fourier transform and power spectral density.

Below you will find codes & notes from various platforms (references are presented at the end of the notebook). Hope that this notebook will be a good start for you as well.

FFT

Fourier transform outputs vibration amplitude as a function of frequency so that the analyzer can understand what is causing the vibration.

The frequency resolution in an FFT is directly proportional to the signal length and sample rate. [3]

Spectrogram

A spectrogram takes a series of FFTs and overlaps them to illustrate how the spectrum (frequency domain) changes with time. [3]

PSD

A power spectral density (PSD) takes the amplitude of the FFT, multiplies it by its complex conjugate and normalizes it to the frequency bin width.

This allows for accurate comparison of random vibration signals that have different signal lengths. [3]

Notes

wave length is length of one cycle. distance/number of cycles

amplitude is median value fo highest and lowest y values in a cycle

period = time/number of cycles --> T frequency = number of cycles / time --> 1/T --> 1/s --> s^-1 --> Hz i.e freq is number of cycles in a second. [1]

Relationships

wave length inc & freq dec & period inc & Energy dec

wavelength ~ period (directly related)

freq ~ Energy (directly related) [1]

Small example

Example 1 -FFT [4]

Example 2 - Waves - FFT - PSD [2]

Example 3 - PSD [5]

Add noise

Example 6 - Spectogram [7]

References: