LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fitting multiple gaussians to curve

Hi,

I'm collecting a data array and saving it to a spread sheet. I can plot this on an xy graph however in order to process the data i need to separate the curve into separate gaussians. In theory decimating the curve should do what i need but I can't figure out how to make this work. Can i do this using point by point, or is there a way of converting each line into a wave to process it in this way?

The attached files are the basic vi that im using to read the saved file and an example file. I haven't included any of the errors as i've made as they haven't worked. I hae tried a simple guassian fit but as the peaks are overlaid on each other it isn't working and i feel sure that theres a better way of doing it than multiple iterations of this, particularly as the number of peaks varies.

Thanks!

Download All
0 Kudos
Message 1 of 11
(4,955 Views)

Hello and thanks for using the forums.

 

If I understand your query correctly, you would like to be able to split your data into separate plot instances on the same XY graph in the simplist way possible. I have attached an altered version of your VI which will plot each gaussian separately.

 

If I've misunderstood your query please feel free to provide some further clarification.

 

Kind Regards,

0 Kudos
Message 2 of 11
(4,923 Views)

Almost. Each data line contains a number of gaussians, which i need to track from instance to instance. I understand the deconvolution vi should be able to decompose the signals in this way but needs an x*y and a y input, where as i only have the x*y. I may of course have completely the wrong understanding of deconvolution in this application.....

Thanks for the time!

0 Kudos
Message 3 of 11
(4,914 Views)

Ah yes I can see now, each data curve has a number of gaussians within it. You mention that what you need to track is each instance of a gaussian, is this regardless of it's size/value? You can use the peak detect VI to do this when configured appropriately.

 

Deconvolution would require you, as well as the convoluted line (X*Y), to know the waveform which you wish to deconvolve. So I don't think that is what you are looking for in this instance.

 

Kind Regards,

0 Kudos
Message 4 of 11
(4,910 Views)

I'm trying to compare the relative intensities of some of the gaussians, the problem being that they overspill into each other. I've tried running the peak detection for this purpose but the very intense section affects the less bright sections surrounding it. This is why i was hoping to be able to deconvolve the curve. As you say i know that I need to deconvolve gaussian forms, just not the exact form they take.

0 Kudos
Message 5 of 11
(4,906 Views)

Hello again,

 

Thanks for the additonal info. I'm afraid I'm not sure how you will be able to deconvolve the gaussian forms from the main curve without knowing the main function itself as this is one of the requirements for standard deconvolution.

 

With the curve as it is and without knowing the main function which you wish to extract, I can't think of a way to isolate the individual gaussians as you describe. The main way I can suggest experimenting further with is using the Peak Detector VI taking both the amplitude and 2nd derivative outputs to determine the sharpness/intensity.

 

Kind Regards,

0 Kudos
Message 6 of 11
(4,891 Views)

I don't have/know Matlab so the following is no use to me, but is there a simple way to implement it in labview? 

http://terpconnect.umd.edu/~toh/spectrum/CurveFittingC.html

 

Cheers (again)

0 Kudos
Message 7 of 11
(4,870 Views)

Hello,

 

There are functions under the mathematics palette such as Guassian Peak Fit which can perform some of these operations to an extent, however you can also implement a Matlab script using a Matlab node if there is a .m file you'd like to try and use. This would require a licensed version of Matlab to be installed in order for LabVIEW to access the script server, but it can be useful for complex mathematical operations to perform them within a script.

 

Kind Regards,

0 Kudos
Message 8 of 11
(4,852 Views)

There is a shipping example that demonstrates fitting data to three gaussians.  This is easily extended to more or less than three.

\LabVIEW\examples\math\curvefit.llb\Fit sum of 3 Gaussians with offset.vi

0 Kudos
Message 9 of 11
(4,842 Views)

Thanks I've been looking at those example Vi's but haven't been able to implement a fit to the data that I've got- with these the initial guess seems to be problematic.

0 Kudos
Message 10 of 11
(4,839 Views)