Finding Accurate Amplitude Using FFT

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';
x = x - mean(x); N = length(x);
win = flattopwin(N);
x = fft(x.*flattopwin(N)); Amplitude = 2*max(abs(x))/N;

ANSWER provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

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.


Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.