I\'m doing video analysis.
The end result array I get is something like:
signal =
Columns 1 through 7
73960 73960 73960 73
I would just write a simple loop over the array in Matlab to achieve this. I don't see any fundamental problems there?
If you don't want loops in Matlab, you can do it with some array operations. If you have two equallly long arrays a and b, you can do something like c = a>b, which gives you a list with ones and zeros. You1 can use this as a oneliner for selecting the maxima/minima.
Zo suppose you have an upshifted and downshifted array b, c. Such that (except at endpoints)
b(n-1)=a(n)=c(n+1). You can get an array containing only the extrema and zeros by q=a.*( (a>b).*(a>c) + (a
One advise: If you signal has noise, than also this selection will be noisy. To smoothen the function, you should apply some kind of moving averaging with a kernel you like.