currently I'm using Mathcad's built in function localmax. It is a great function but it yields too many false positives and in some case (see attached file) also outright false ones.I've fiddled around with the window size but the results are not very convincing.
Does anybody know how to improve this?
While you may think that the function erroneously finds local minima - if you zoom in you see that it actually finds local maxima! Maybe applying a smoothing function before looking for maxima will do a better job.
I found a Mathcad function localmax1() in my archive. Not sure where it stems from and whom I should give credit for. Can it be thats it from an early Mathcad DAEP (Data Analysis Extension Pack) where the functions where delivered as regular and readable Mathcad functions? This would mean that something went wrong in the evolution of that DAEP.
Anyway, this function does away with the missing peaks of the built in localmax, which I consider a bug. Using a window size of 100 may be a solution for your problem as it seems to deal with the local max's caused by the tiny bumps in the signal?
thank you for the function. It works in a fashion. Data smoothing prior to localmax and some other cleaning did the rest.
I don't like to increase the window size too much as I might miss some points. I'm using the local maxima to determine an exponential fit which gives me the envelope. This in turn yields a long term trend from my data set of about 5000 measurements. Therefore I do like to reduce false positives.