What is the correct normalization for a flat top window?
조회 수: 15 (최근 30일)
이전 댓글 표시
Hi, I have a question about FFT. Considering that I have a data vector of accelerations sampled with an accelerometer and that I want to apply a flat top window, in order to obtain the most accurate amplitude in the FFT, what would be the right code for normalization in this specific case?
I tried this one, but I'm not sure if it's correct:
N=numel(data);
w=flattopwin(N);
X=2*fft(data.*w)/sum(w);
Thanks in advance for you help.
댓글 수: 1
Mathieu NOE
2024년 4월 23일
try with a sine wave of known amplitude for instance (amplitude = 1 could be quite convenient !)
채택된 답변
Sudarsanan A K
2024년 4월 29일
Hello Claudio,
Your approach to applying a flat top window and performing the FFT to obtain accurate amplitude information from your data vector is on the right track. The flat top window is particularly useful in spectral analysis when accurate amplitude measurements are essential, as it provides a very flat spectrum for the main lobe, minimizing amplitude errors for signals within its bandwidth.
Here is a simple demonstration of the normalization:
%% I am using a simple signal which is sum of two sinusoids
% Parameters for the signal
fs = 1000; % Sampling frequency in Hz
T = 1; % Total time duration of the signal in seconds
f1 = 50; % Frequency of the first sine wave component in Hz
f2 = 150; % Frequency of the second sine wave component in Hz
A1 = 1.0; % Amplitude of the first sine wave component
A2 = 0.5; % Amplitude of the second sine wave component
% Generate the time vector
t = 0:1/fs:T-1/fs;
% Generate the signal
signal = A1*sin(2*pi*f1*t) + A2*sin(2*pi*f2*t);
%% Apply a flat top window
N = numel(signal);
w = flattopwin(N);
windowedSignal = signal .* w';
%% Perform the FFT
X = fft(windowedSignal);
%% Normalize the FFT output
X_normalized = 2 * abs(X) / sum(w);
% Frequency vector
f = (0:N-1)*(fs/N);
%% Plotting
figure;
subplot(2,1,1);
plot(t, signal);
title('Original Signal');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(2,1,2);
plot(f(1:N/2), X_normalized(1:N/2));
title('Magnitude Spectrum with Flat Top Window');
xlabel('Frequency (Hz)');
ylabel('Amplitude');
xlim([0 200]);
Also, consider the following:
- If you are using the FFT output to calculate power spectral density or similar metrics, further processing might be necessary.
- The choice of 2 as a normalization factor assumes you are analyzing the one-sided spectrum. If you are looking at the full spectrum or have complex-valued data, you might need to adjust this.
- Ensure that your signal of interest's frequency components fall within the main lobe of the flat top window's frequency response to benefit from its amplitude accuracy.
For more information about the "flattopwin" function, please refer to the documentation:
I hope this helps!
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spectral Measurements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!