I need to find the frequency and amplitude of a signal. My signal is this (Number of Samples= 9500
taken at 500Hz
):
I tried the following code for FFT (found here):
Fs=500;
L=numel(pitch);
Y=fft(pitch);
f = Fs*(0:(L/2))/L;
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
figure
plot(f,P1)
The result I get is this (amplitude=7.501
):
But this is not accurate. If I calculate the amplitude from the peaks, amplitude=9.3
, which looks correct.
Why does the FFT give a inaccurate result and how can I find the correct result (frequency + amplitude) by using FFT or any other method? I have several signals which are in general noisy, so finding peaks is not possible.