LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Peak Detection

Solved!
Go to solution

Hello, I would like to develop a software to detect peak. I've tried the peak detector but the peak amplitude and the location is not accurate, and the accuracy is a very important info for me. Therefore, i compile a code using Array Max & Min but there is a few problem:

1. It can only detect 2 peaks amplitudes and locations for now where in my case i may want to detect up to 5 peaks

2. The first peak must be higher than the second peak in order to get detected, but that is not necessary in my case.

I've attach my VI and saved my result as the default, hope u guys can help me out, thank you in advance.

Download All
0 Kudos
Message 1 of 7
(3,382 Views)

Hi newuser,

 

I've tried the peak detector but the peak amplitude and the location is not accurate, and the accuracy is a very important info for me. Therefore, i compile a code using Array Max & Min but there is a few problem:

Why is the location of PeakAmplitude not accurate?

With ArrayMinMax you will get exactly ONE (1) peak in your array data: when you need more peaks you need to use a loop to search for more ArrayMax values. (Don't forget to replace the already found maxima by -Inf to avoid finding the same peak again and again…)

 

Some notes:

When attaching RT/FPGA VIs you really should attach the project file too.

Are you sure about using that PtByPt-Mean with a sample length of 1023?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(3,365 Views)

1. The location seems to be correct but the amplitude is abit inaccurate, and the peak interested is the highest point only(for each fluctuation), but if peak detector were used, it will find all the peak detected.

2. How to find the next max by using loops as you mentioned?

3. i set to 1023 is because the number of elements i set is 2046 and divide by 2, and this is the block size isn't it?? if it wasn't, what number should i put for the sample length of mean?

1.PNG

I can't post my project file, how to post it? Thank you in advance.

Download All
0 Kudos
Message 3 of 7
(3,346 Views)

Hi new user,

 

to post your project file you just ZIP your folder, which (hopefully) contains the lvproj file next to those VIs!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(3,341 Views)
Solution
Accepted by topic author newuserneedhelp

Read the help for peak detection to learn how it work (fitting a square function)

 

one possible way:

do a peak detection with a reasonable peak point width

with the resulting array enter a for loop to find the single point max value in that range (again about the same width choosen before)

 

going for a single value peak is always prone to noise ...

 

here is something to play 🙂

peak detect play.png

Q&D 🙂 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 5 of 7
(3,334 Views)
Thanks Henrik, this is the solution I searching for, haha However, out of curiosity, is there any other way of using 'Max and Min' and Loop without the peak detector? Thank you once again.
0 Kudos
Message 6 of 7
(3,294 Views)

GerdW, this is the zip file of my whole project, please take a look and see if there is any other mistake that i could change, thank you

0 Kudos
Message 7 of 7
(3,292 Views)