LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extraction of main peaks from a signal

qureshi000_0-1747802669873.pngqureshi000_1-1747802709784.png

I’ve attached two images for reference. In the first image, you can see two main peaks that I want to identify and extract the values of (both x and y). However, the issue arises when I zoom into one of the peaks as shown in the second image where multiple smaller peaks appear around the main one. The scenario I’ve shared currently contains two prominent peaks, but this can vary. Sometimes there may be no significant peaks, while in other cases, there could be five or six or even more. I’m looking for a method to accurately extract the values (both x and y) of the main peaks as shown in the first image.

I’ve also attached a sample VI file with saved data for better understanding. Kindly guide me on how to approach this.

0 Kudos
Message 1 of 5
(144 Views)

Ask yourself : What is your criteria/rules to define  main peaks?

Well, is is higher than the others...

but wait...  maybe it's just higher than the surrounding ones...   relative? absolute to ?? 

 

so find and define the rules!  after that, convert these rules to code 🙂

 

Maybe it's just

find all peaks , choose the top 20%(or XX%)   (by count or value) ,

or have a look at a peak value histogram, maybe that give you an idea..

more specific: if one high peak is identified , in what x axis range lower peaks should be ignored?

 

This type of task is very common in analysing spectra , so look for algorythms/methods used in this (wide) area. (well, usually they don't want to ignore peaks....)

 

If you later know the rules you want to apply

 

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 ǝɥʇ'


Message 2 of 5
(104 Views)

here is maybe one solution:

I used peak search with a relative threshold and peak width of 3 sample , give more peaks ...

next take the list of peaks and within peak distance (scaled to your x)  decide wheater to take the bigger one of to add it to the result.

Testing 2.png

peak search use a square fit over peak width sample, so the x value can be fraction of sample ... and the max peak value is not equal to the max sample value.  

If your crosscorrelation is due to sine sweep and response (lock-in amp ?)  the shape of the peak result migth be an absolute of sync function. By fitting that you can get even better results 😉  

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 ǝɥʇ'


Message 3 of 5
(82 Views)

One possibility would be to integrate the signal, find the flat levels and find where the integral trace crosses the halfway point between them to get the position (and the step size will give you the area).

 

(sorry, cannot open your Vi unless you do a "save for previous", 2020 or below)

0 Kudos
Message 4 of 5
(72 Views)

There are tools already built into LabVIEW to help you do what you are looking for. See blow:

 

aeastet_0-1747850179156.png

 

Tim
GHSP
Message 5 of 5
(70 Views)