Find maximum peaks in fft and power spectral density function
11 次查看(过去 30 天)
显示 更早的评论
I have an array ( raw_acceleration) of 1600 elements acquired every 10 seconds at 160Hz from a sensor. I use this array to calculate the fft and the Power Spectral Density and it works very well:
Fs=160;
raw_acceleration = u;
N = length(raw_acceleration);
xdft = fft(raw_acceleration);
xdft = xdft(1:floor(N/2+1));
psdx = (1/(Fs*N)) * abs(xdft).^2;
psdx(2:end-1) = 2*psdx(2:end-1);
freq = 0:Fs/length(raw_acceleration):Fs/2;
plot(freq,10*log10(psdx))
grid on
xlabel('Frequency (Hz)')
ylabel('Power/Frequency (dB/Hz)')
I obtain this plot:
As you can see, I obtain four peaks centered around four different frequencies.
I would like to have a Matlab code which is able to automatically find these four maximum peaks and their frequency. At the moment, I always need to plot the graph and manually detect the maximum peak and its frequency.
Is there any way to do this by code? I hope you an help me.
I attached a sample of raw_acceleration array.
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Parametric Spectral Estimation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!