02-02-2020 07:48 AM
02-19-2020 06:12 PM
Set a threshold (for example in your image you could set a threshold of like 1.2 and when you cross above the threshold, set i to the threshold. When you cross the threshold, send i to a "target to host" fifo.
03-25-2020 10:47 PM
Thanks for your advice nanocyte.
But eveytime the peaks may comes with different values, so set fixed threshold doesn't seems like a good idea for my application.
03-25-2020 10:53 PM
It's hard to make recomendations without more data sets. I really just have to guess. Could you do a dynamic threshold based on a local minimum (say the minimum of the last 256 samples) + a fixed offset? Or maybe look at NI's peak detector VI which uses second order regressions?
04-13-2020 12:14 PM
A simpler approach would be considering this as a runtime bubble sort of 3 elements.
Suggested pseudo code,
<Reset>
firstPeak = -inf
secondPeak = -inf
thridPeak = -inf
<Inloop>
if (value >= firstPeak)
firstPeak = value
elseif (value >= secondPeak)
secondPeak = value
elseif (value >= thridPeak)
thridPeak = value
This can also be considered as top N-sorted values.
04-13-2020 12:22 PM
Wouldn't that just return the top 3 values all of which are in peak 4? I think OP wants the max of each peak.
04-15-2020 03:11 AM
Actually I think you made a good point, if I can get peak in a window, I might be able to tell different peaks online.
Thanks, I will put that on test when I figured out how to code this down, a moving window is a good start:)