evaluate rising edge sample of a signal
12 views (last 30 days)
alessandro mutasci on 24 Aug 2021
Good evening, I'm trying to evaluate the rising edge samples of the signal,for each local maximum and minimum, that I have highlighted in red,in the Figure, and put them in a vector. I tried with "islocalmin" to locate the minimum but it wasn't able to locate anything.
Can you give me some advices.
Turlough Hughes on 24 Aug 2021
Edited: Turlough Hughes on 24 Aug 2021
Is it just the local minima you're having trouble with?
The rising edge is found where the slope of the original data is positive. You can get the start and end of these regions where the slope is positive and they also correspond to the min and max of the rising edge:
dMf = [0; diff(smooth(Mf,'moving',5))];
title('Slope of Signal')
idx = dMf > 0; % index for rising edges (where slope > 0).
% Get start and end indices for rising edges.
iStart = find(diff(idx) == 1) + 1;
iEnd = find(diff(idx) == -1) + 1;
if idx(1) == 1
iStart(1) = [1; iStart];
if idx(end) == 1
iEnd = [iEnd; numel(idx)];
idel = iEnd - iStart <= 20; % threshold size for a group
iEnd(idel) = ;
iStart(idel) = ;
legend('Original data','Rising edge','Min','Max','Location','NorthWest')