Link to home
Start Free TrialLog in
Avatar of salamay
salamayFlag for United States of America

asked on

Peak Detection using VBA

Iam trying to detect peaks using VBA and found someone has written a nice function to do this in MATLAB here http://www.billauer.co.il/peakdet.html

Can someone help me convert it to VBA?

Thanks
Avatar of Saqib Husain
Saqib Husain
Flag of Pakistan image

At the moment here is a non-VBA solution. This independant of the link provided. Unless someone comes up with a VBA solution earlier I shall attempt that too.


Peaks.xls
Avatar of salamay

ASKER

well that works fine if you are interested in every peak in a signal.

But it fails when a signal is noisy and you dont need every peak but only the ones which are max.

Se what I tried in my workbook.

First play with the clean signal (click amplitude button on the chart)
For the selected TOF the very next peak or valley can be found easily with the (n-1)< n >(n+1) algorithm

but to find the right ones in a real (noisy) signal you have to do something more than just that.
I tried a moving average filter but that didnt work either. AmpTest.xlsm
Avatar of salamay

ASKER

There are so many experts here with years of experience.

Someone please help!
ASKER CERTIFIED SOLUTION
Avatar of byundt
byundt
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.