フィルターのクリア

Find maximum peaks in fft and power spectral density function

12 ビュー (過去 30 日間)
marcusbarnet
marcusbarnet 2018 年 3 月 29 日
コメント済み: marcusbarnet 2018 年 3 月 29 日
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 件のコメント
Birdman
Birdman 2018 年 3 月 29 日
Can you attach your original data?

サインインしてコメントする。

回答 (1 件)

Birdman
Birdman 2018 年 3 月 29 日
  6 件のコメント
marcusbarnet
marcusbarnet 2018 年 3 月 29 日
I attach also the freq array
marcusbarnet
marcusbarnet 2018 年 3 月 29 日
I tried to use max() function in Matlab, but I found out that it doesn't work as I would like..

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeParametric Spectral Estimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by