Finding Accurate Amplitude Using FFT

Greetings,
I have been working on code to use the FFT to find the amplitude of a signal. However, despite my best efforts to window I seem to get incorrect amplitudes. When I manually find Amplitude by inspecting the signal I get A = 63.7. When I use the following code I get A = 54.8. This is causing significant errors in my Bode plot.
I tried using a flat top window to maximize amplitude accuracy. My signal does not seem significantly noisy. I expected an amplitude much closer to the true value.
function Amplitude = Gaindb(x)
if size(x, 2) > 1
x = x';
end
x = x - mean(x);
N = length(x);
win = flattopwin(N);
x = fft(x.*flattopwin(N));
Amplitude = 2*max(abs(x))/N;
end
Regards, Andy

 Risposta accettata

David Goodmanson
David Goodmanson il 22 Mag 2018

0 voti

Hi Andy,
When I run your code I get 14.5 for the answer, so I am not sure how you are getting 54.8. But the 14.5 is consistent with the Matlab definition of the flattop window. From the documentation, the flattop is a sum of cosines with certain coefficients, along with a constant coefficient a0 = .216. a0, the area of the window, is basically the amplitude reduction factor for the signal.
Without any windowing of x, the fft comes up with a signal amplitude of 67.1, and 67.1 x .216 = 14.5 which is consistent.
The Matlab window peaks out at a value of 1.
Wikipedia has an example a flattop window from SRS that multiplies all the coefficients by 4.639, so the window peaks out at that value and a0 = 1. For a continuous sinusoidal signal such as yours the resulting amplitude will be basically unchanged.

1 Commento

Ah, my understanding of windowing must have been my limiting factor. Thank you David!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su MATLAB in Centro assistenza e File Exchange

Prodotti

Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by