Reputation: 163
I have used the findpeaks
function in MATLAB to find the locations and the values of the peaks (Local Maxima) in the signal.
[pks, locs] = findpeaks(X_Segments{nn},'MinPeakDistance', 20);
AverageDistance_Peaks(nn,:) = mean(diff(locs));
X_Segments
contains the data.
Is there any function to extract the local minimums of the following graph?
Upvotes: 2
Views: 751
Reputation: 65430
Just negate your signal first. This will then give you the local minima.
% Pass a negative version of X_segments
[pks, locs] = findpeaks(-X_Segments{nn},'MinPeakDistance', 20);
AverageDistance_Peaks(nn,:) = mean(diff(locs));
% Change the sign back to be the correct one
pks = -pks;
Upvotes: 1