In FFT (Fast Fourier Transform), the step size refers to the spacing between consecutive points in the output data after performing the transform. It's often determined by the sampling rate of the signal. The step size is crucial for accurate frequency representation, and smaller step sizes provide finer frequency resolution in the resulting frequency domain representation.
Step Size of a Signal in the Time Domain (in general)
Suppose you have a signal sampled at 1000 Hz (sampling rate) for a duration of 1 second. The step size, or the time difference between consecutive samples, is then given by the inverse of the sampling rate:
Step size = 1 / Sampling rate = 1 / 1000 Hz = 0.001 seconds
General Frequency Resolution:
Sampling frequency fs=1000HzDuration T= 1 second
Number of samples N=fs⋅T=1000⋅1=1000
Δf=1 / T
Δf=1 / 1 second = 1 Hz
Frequency Domain Step Size in FFT
Step Size in the Frequency Domain
The step size in the frequency domain refers to the spacing between adjacent frequency bins in the FFT output. It is determined by the signal's sampling rate and the size of the FFT:
Where:
- Δf: Frequency step size (frequency resolution).
- fs: Sampling rate (Hz).
- N: FFT size (number of bins).
Total Bandwidth
The total bandwidth covered by the FFT is determined by the sampling rate and the Nyquist theorem:
Frequencies above the Nyquist frequency (fs/2) cannot be represented due to aliasing.
Frequency Step Size after FFT
Combining the above, the frequency step size (bin width) in the FFT output is:
Suppose:
-
Sampling frequency: Hz
-
FFT size:
-
Then:
So, your FFT bins are spaced about 1.953 Hz apart.
Key Observations:
- Smaller Δf results in higher frequency resolution.
- To achieve smaller Δf, increase the FFT size (N) or the signal's duration (T).
- Total bandwidth is inversely proportional to the number of bins (N).
Time Domain Step Size in FFT
Sampling frequency fs = 1000 Hz
FFT window length = 512 samples
Hop size = 256 samples (i.e., 50% overlap)
Then:
Each FFT is calculated on a 512-sample window
The window shifts forward by 256 samples
Time step size = 256 / 1000 = 0.256 seconds
So, a new FFT is computed every 0.256 seconds of the signal.
MATLAB Code
% The code is developed by SalimWireless.Comclc;
clear all;
close all;
% Parameters
fs = 1000; % Sampling frequency (Hz)
T = 1; % Duration (seconds)
N1 = 256; % FFT size for coarse resolution
N2 = 1024; % FFT size for fine resolution
t = 0:1/fs:T-1/fs; % Time vector
% Signal with multiple frequency components
f1 = 50; % Frequency 1 (Hz)
f2 = 60; % Frequency 2 (Hz)
f3 = 200; % Frequency 3 (Hz)
signal = sin(2*pi*f1*t) + sin(2*pi*f2*t) + sin(2*pi*f3*t);
% FFT with coarse resolution (N1)
fft_coarse = fft(signal, N1);
frequencies_coarse = (0:N1-1)*(fs/N1); % Frequency vector
magnitude_coarse = abs(fft_coarse);
% FFT with fine resolution (N2)
fft_fine = fft(signal, N2);
frequencies_fine = (0:N2-1)*(fs/N2); % Frequency vector
magnitude_fine = abs(fft_fine);
% Plotting
figure;
% Coarse Resolution Plot
subplot(2, 1, 1);
plot(frequencies_coarse(1:N1/2), magnitude_coarse(1:N1/2));
title('FFT with Coarse Resolution (N = 256) where step size is 3.906');
xlabel('Frequency (Hz)');
ylabel('Magnitude');
grid on;
% Fine Resolution Plot
subplot(2, 1, 2);
plot(frequencies_fine(1:N2/2), magnitude_fine(1:N2/2));
title('FFT with Fine Resolution (N = 1024) where step size is 0.977');
xlabel('Frequency (Hz)');
ylabel('Magnitude');
grid on;