Finding peak of a noisy data
26 views (last 30 days)
I need help with finding peaks (in other words cycles) for the plot below.(data attached). I tried two methods but still cannot get it right. Using the finepeaks it kept giving me peaks that at not really peaks. With polyfit, the curve wasn't fitting "accurately". Any help is appreciated.
p = polyfit(x,y,6);
y1 = polyval(p,x);
I see that you have experimented with some of the many options in findpeaks(). You may need to combine the options to reliably identify the "real" peaks, i.e. those that you regard as peaks.
When I look at this plot, I am not sure which local maxima are the real peaks, and which are not, and why. I reocmmend that you add symbols at the "real" peaks, and think about why you have rejected the other local maxima. This process may help you determine the correct combination of options for findpeaks().
t=data.ans(:,1); x=data.ans(:,2); %extract the data
plot(t,x,'-b'); grid on; hold on %plot the data
%next: find some peaks
plot(locs,pks,'*r'); %add found peaks to the plot
In the script above, I divided the parameters that have units of distance (or time) (minpeakdistance, minpeakwidth) by 8, because I have passed t, the vector of locations. The sampling interval for t is approximately 1/8. Therefore the location-dependent parameters must be scaled accordingly. I passed vector t so that the locs vector which is returned by findpeaks() will correspond to the horizontal coordinates of the original data. This allows me to plot the found peaks in the right places.
Experiment with the above.