I am trying to find the first 5 peaks in the PSD plot of an acoustic signal. While I do not have any bugs in my code, it is not finding actual peaks and looks more like arbitrary locations. I will paste my code below:
M = movmean((PSD), 50);
plot((maxloc), maxpks, 'r*')
J= [sortpks(j),sortpks(j-1),sortpks(j-2), sortpks(j-3), sortpks(j-4)];
ML = maxloc(j-4:j);
Fit = polyfit(ML,J,1);
yfit = Fit(1)*ML+Fit(2);
The picture above is a zoomed in version of figure 1 and it is just not detecting the peaks I need. Thank you in advanced for any help!