From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data fitting spectrums

Hi, I am new to labview and may have bitten off more then I can chew with this project. I need to fit data for that graph below, where each one of those peaks needs to be fit. I have been looking around the forums but have been unable to find how to do advanced fitting. I can get the points in as 1-D arrays for both X and Y but don't know where to go from there the tutorials on labview didn't seem to have this information. Any pointers in the right direction would be helpful.

 

Thanks,

-ZG 

example data.png

0 Kudos
Message 1 of 5
(2,984 Views)

You'd probably want to filter the data first so the noise doesn't appear as peaks.  This might not be required, but it's something to keep in mind.

 

Then, check out this forum post: http://forums.ni.com/t5/LabVIEW/Line-of-best-fit/td-p/948306

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

ZG,

 

How many peaks are in the data shown in your image? 1? 7? 8? Hundreds? Do you have a mathematical mode for the shape of the peaks? Do you have any knowledge of the system which places constraints on how close together the peaks may be?  Is the large overall shape a peak which fits the same model? Besides the noise are there other "things" in the data which might look like peaks but are not?

 

Have you searched the Forums for Peak Fitting? There are many threads on the topic, some of which discuss fitting multiple peaks.

 

Lynn

0 Kudos
Message 3 of 5
(2,976 Views)

Lynn,

In this case there are around 12-15 Peaks however there can be cases where there are a 100 or more over a large x range, for now I am treating them as Gaussian curves as for how far apart the peaks are now this is expected to be the closest they will be and they will get further apart when I switch samples. Other then that large amount of noise all peaks will be signal. 

-ZG

0 Kudos
Message 4 of 5
(2,965 Views)

Do you have additional information, for example are all peaks of the same width? Are they equally spaced? Do they form a known pattern?

 

For example, your data could probably be fitted equally well with a series of similar Gaussian, each about 100 wide where the various peak amplitudes form a certain envelope, or it could be fit as one large gaussian about 400 wide with a few overlapping smaller Gaussians to create the ripples. Could it be a binomial distribution convoluted with a single Gaussian? Are all ampitudes positive?

 

Any fit of a set of peaks is necessarily ambiguous, because you can swap the paramters of any two peaks and the fit is exactly equivalent. You could even fit a single Gaussian as a sum of two Gaussian with equal position and width, but different amplitudes or even fit a flat baseline as two such peaks with opposite amplitudes. Looking at parameter correlations will allow you to detect these scenarios. You could sort the peaks by x position, or some other terms to make the solution more unique.

 

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