01-18-2021 08:55 PM - edited 01-18-2021 09:42 PM
Hello application engineers,
I would like to find peaks on a curve that is obtained via data acquisition. I tried both Threshold Detection and Peak Detection, However, no success.
The issue is that sample VIs compares a threshold with all values, while I just want to compare the threshold with a local value or moving value. I used a moving average as a base and added a Delta value to make a threshold. A peak should be identified when the peak has values greater then the "moving average + Delta". The curve shows there are three narrow peaks at times of 250, 351 and 437 s respectively.
Attached are the two VIs, one uses threshold detector VI, another uses peak detector VI.
The VIs simulate the data acquisition process and I like to detect the peaks while data acquisition is in progress.
Can someone help me with the issue?
Best regards,
Gu
Solved! Go to Solution.
01-19-2021 05:09 AM
here is maybe one possible solution
(since you post data it was possible to help 🙂 )
I used a highpass on the data , did a first peak search on the that highpass data
used the results to search on the raw data
finally recalc positions to x data
Q&D no cleanup in the code 😄
01-19-2021 05:10 AM - edited 01-19-2021 05:11 AM
in the highpass data you see another small peak around 400 😉
curious: What are you looking at ?
01-19-2021 05:29 AM - edited 01-19-2021 05:31 AM
Another hint: Seems that you are lookung at frequencies (vs impedances?)
the 250, 350 and 400 peak are 5,7 and 8 times the 50 Hz line frequency, so if 50 Hz is your line freq, make shure you are not false detecting EMC influences on you setup. 😄
01-19-2021 08:16 AM
instead of a highpass I used 1st derivative and PtbyPt routines ... and finally a peak detection on the raw data
(second coffee break)
play with the parameters 🙂 and see the different results for the first three detected peaks
01-19-2021 10:56 AM
Hi Henrik,
Thank you for your effort to help out. Could I trouble you to convert the two VIs into Labview 2015, which is the version I am using, it can not open newer version files.
Best regards,
Gu
01-20-2021 01:08 AM
here you go
01-20-2021 03:09 AM
Hi Henrik,
Thank you very much for the converted 2015 file. The first order derivative followed by a point by point search is a very nice way of doing this, which can fit my live stream data process. I need to learn something more online for me to better understand the way you used for-loop. It is my first time to see using an array as a For-Loop's iteration N, and also first time to see bundle on right side of the loop.
Could you please also convert your first Vi that use high-pass filter, I would like to learn it more.
Regards,
Gu
01-20-2021 05:11 AM
try it
01-20-2021 12:29 PM
Hi Henric,
Thank you for your kindly helps.
I have been using Labview since version 6.0, however, I just used it occasional when a project required, so I am not a very experienced user. Could you please help me to understand your way of solving my problem. I searched NI web for related info, however, still need further learning from you. I post part of your code here for a reference.
1. On the right edge of the for loop, you bundled auto-index with a Boolean (peak found?). How were the two parameters bundled together, how the bundle pass values during iteration?
2. You used the same value for the first order derivative's inputs (x and initial condition), Could you please explain the idea behand it?
3. You used peak search offset, the reason and how the value -20 was chosen?
I make a correction here as I mentioned that you used an array for loop iteration N, I noticed that it was my mistake. The array index was just behand the N, I moved the index down a bit to separate them.
Best regards,
Gu