10-30-2018 11:52 AM
I'm developing a peak detection algorithm. I was wondering is it possible to create a condition such that when one point is detected, the data must go below a certain value before another point can be detected?
10-30-2018 12:22 PM - edited 10-30-2018 12:24 PM
Yes, it is possible.
(Keep the condition in a shift register or feedback node.)
Have you tried the built-in peak detector?
10-30-2018 01:11 PM
I have attempted the peak detection, but it picks up a larger peak twice which I would like to stop by saying that the value has to drop below a certain point so it moves to the next peak. I have tried other methods which would also benefit from this condition.
I need to develop another form of algorithm to the built-in vi as I would like to compare different methods and their effectiveness to the built-in detector.
Thank you
10-30-2018 01:47 PM - edited 10-30-2018 02:13 PM
Can you comment on the VI you have attached, because it seems extremely convoluted. What is the purpose of showing us this? Is it your attempt at "peak detection"?
Again, why do you show us this VI. It seems quite unrelated to the problem and looks completely broken in functionality..
10-30-2018 02:43 PM
@swilson8 wrote:
I have attempted the peak detection, but it picks up a larger peak twice which I would like to stop by saying that the value has to drop below a certain point so it moves to the next peak.
It seems to pick exactly 6 peaks. looks fine to me. 😄
11-01-2018 04:23 AM
Sorry for the slow response and the state of the vi. I've been testing lots of things at a time so the vi is rather experimental as I was trying to see what would solve the problem.
The Boolean section was an attempt to create a condition that would mean that only values where dx/dt = 0 and d(^2)x/dt(^2) < 0 would be detected. It kept throwing out an issue where the source was Boolean and the sink was Boolean but it wouldn't accept it for the case structure, I was trying to (but failing) to overcome this.
Your peak detection does appear to give nice values, but it still uses the vi which I am unable to for the purposes of this. This is why I was trying to create this new condition where a peak is detected and then the data must drop below a value before a new peak is then detected.
Thank you
11-01-2018 01:02 PM
Every derivative emphasizes noise and your first and second derivative criteria are not suitable for noisy and spaced data.
NI has worked hard developing a robust peak detector and I seriously doubt that you could do better. Unless you only have LabVIEW base, that's what should be used. What's the reason you don't?
11-02-2018 10:45 PM
Well if you aren't going to use the NI built-in VIs then you should poke around the web for pre-existing solutions. There are many available in many languages you could translate and test. One popular one is by Eli Billauer - http://billauer.co.il/peakdet.html
Its quite a clever simple solution to finding peaks/valleys but I haven't tested it on real data to compare to NI VIs. It works for your data, but probably not all data.
Here's a LabVIEW version of Eli's code, added to altenbach's tidy code for comparison.