Find the nonzero maximum frequency corresponding to FFT graph.
2 visualizzazioni (ultimi 30 giorni)
Zahra il 27 Apr 2023
I want to find the maximum corresponding frequency for the ftt graph. The graph shows the maximum frequency at zero frequency, this is not what I want. I am expecting to have a value around 664 Hz.
so=dat.data(:,2); %original signal
Fs=1/dt; %sampling frequency
F_fake=f(find(SOa(1:round(length(SOa)/2))==max(SOa))); % I am getting zero instead of 663.9 Hz.
I want a value which is nonzero. How to eliminate the zero Hz frequency ?
David Goodmanson il 27 Apr 2023
Modificato: David Goodmanson il 27 Apr 2023
the peak at zero frequency is because your signal does not have average value of zero, but has a DC offset. To eliminate the zero freq peak you can remove the offset by subracting the mean off of the signal. So you can use not fft(signal) but rather fft(signal-mean(signal)). (This assumes that the DC offset is not of interest in this case).
Più risposte (1)
Paul il 27 Apr 2023
Modificato: Paul il 27 Apr 2023
If the DC offset is of interest (or even if it isn't)
[maxSOa,index] = max(SOa(2:end)); % ignores first point a f=0
F_fake = f(index+1)
This approach will find the the frequency corresponding to the first maximum value in SOa(2:end) should there be multiple occurrences of the maximum value.