LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Peak Width

I am wondering if the Peak Detector VI can be used to calculate the width of a peak.  The VI, given an input signal, will give the following outputs:
 
# found, locations, amplitudes, and second derivative.   
 
I am curious as to whether this information can be used to approximate the shape of the peak, so that I can calculate the time width (t2 - t1) between two points on the peak curve.  These two points would be at the same vertical distance from the x axis.  Can the 2nd derivative be used to accomplish this?  When I run the VI, an array of 2nd derivative values is produced, which give the sharpness of the peaks usually as some negative number.  My question would be:  How is the 2nd derivative calculated?  Is it based on a polynomial function?  Is it a constant value, or is it a function of time?
 
Is there a better way of doing all this?
 
Thanks,
 
Mark    
0 Kudos
Message 1 of 5
(5,928 Views)

Hi,

As far as I know, the LabVIEW's Peak Detector algorithm performs quadratic fitting on a sliding data subset to identify the peaks and valleys in the data. As long as the 2nd order fit approximates your data reasonably well, you can use it to estimate the peak width. I don't think it is usually the case, so you get a rough estimate at best.

I  did this at some point. I got the following expression for the full width at half magnitude (FWHM) of the peak:

 FWHM = 2 sqrt (-y/y")

where y and y" are the signal and it's second derivative at the peak, respectively, that the Peak Detector gives you. You may wish to check my algebra at some point. 

I would also consider performing secondary fitting on the identified peaks, say, Gaussian, to obtain a better width estimate. Level crossing detection may be another approach.

Good luck!

Zador

0 Kudos
Message 2 of 5
(5,914 Views)

Hi Zador,

Thanks for the reply. 

This is the logic I used, and I ended up with the same expression you had.

y" = A

y' = At + C1

y = A/2 * t^2 + C1t + C2

Assuming peak occurs at t = 0, and that the peak occurs at a relative maximum, then C1 = 0, and C2 = peak value

So, the equation is y = A/2 * t^2 + PEAK

At y = 1/2 PEAK,

Width = 2*sqrt(-PEAK/A), which looks to be the same thing you got.

This assumes that the 2nd derivative is a constant, and not some hidden function of t.  It also assumes the function is a polynomial type.  Are these assumptions correct?

You also mentioned some other methods I can use to calculate width.  Are there Mathematical VIs in LabVIEW that can calculate width for every peak index in the array?  Or would using the 2nd derivative part of the Peak Detector be the best way to do this in your opinion?

 

Thanks,

Mark

 

 

 

 

 

 

0 Kudos
Message 3 of 5
(5,906 Views)
The problem with the LV peak detector is that is only observes a small portion of the "peak", and doesn't actually detect full peaks, at least not to my knowledge.

Judging by the description in the help, the "width" determines over how many points the polynomial is fitted, which can be significantly smaller than the peak itself......

If you have fully resolved peaks, then the calculation of FWHM should be easily possible.  If you have overlapping peaks, then it gets significantly more difficult.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 4 of 5
(5,899 Views)
I concur with the above. As always, the best choice for a technique depends on the signal behavior. If you have non-overlapping peaks on a flat background then you can pretty much do no wrong.
 
I use Levenberg Marquardt algorithm for non-linear fitting (included in analysis VI's). For example, use A*exp(-(X-B)^2/C) as the model to fit to a Gaussian. You can plug in the peak amplitude and location as A and B, while the result for C will be the peak's half-width squared.
 
It looks like Trigger and Gate express VI can be used measure peak width by level crossing detection. I haven't done it, but I would configure it as shown in the attached image, then call it repeatedly as I move along the data set from peak to peak.
 
Zador  
 
 
0 Kudos
Message 5 of 5
(5,888 Views)