‘... it gives 1×0 empty double row vector.’
That is most likely because the dependent variable vector (is this ‘y’ in your code?) must be the first argument to findpeaks (link). Try this instead:
[pks,locs,widths,proms] = findpeaks(y,x);
or preferably, just return the indices of the peaks in the ‘locs’ output with:
[pks,locs,widths,proms] = findpeaks(y);
I find the indices easier to work with.
Best Answer