# find peaks in power spectral density

28 views (last 30 days)
prosper evergreen on 5 May 2020
Answered: Ayush Gupta on 10 Jun 2020
I have the power spectral density of an audio file and i need to find the frequency of all the peaks in the PSD. please help
Fs=2800;
S=y1(:,1);
S_filtered= (S);
N= length(S);
T=1/Fs;
tmax=N/Fs
t=0:T:tmax-T;
axes(hAxes1)
plot(t,S_filtered);
ylabel('Amplitude,db');
xlabel('time,s');
title('ossilogram');
handles.fs=Fs;
%Ð¡ÐŸÐœ
handles.nfft=handles.fs;
Nw=1024;
s=handles.fs/24;
Fmax=1400;
noverlap=512;
%window=hanning(Nw);
df=handles.fs/handles.nfft;
Nf=fix(Fmax/df);
handles.f=0:handles.fs/2;
[handles.Pxx1,handles.f]=pwelch(S_filtered,window,noverlap,handles.nfft,handles.fs);
%Ð¡Ð¿ÐµÐºÑ‚Ñ€
figure
plot(handles.f(1:Nf),handles.Pxx1(1:Nf));
%title('Ð¡Ð¿ÐµÐºÑ‚Ñ€Ð¾Ð³Ñ€Ð°Ð¼Ð¼Ð°');
ylabel('');
xlabel();
[pks,locs] = findpeaks(handles.f,handles.Pxx1);
##### 2 CommentsShowHide 1 older comment
prosper evergreen on 6 May 2020
sorry, here's the file. thanks

Ayush Gupta on 10 Jun 2020
Try following this approach, it returns the out array with frequency count of each peak:
[pks,locs] = findpeaks(y1);
un = unique(pks)
out = [un,histc(pks(:),un)];