LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I extract a gaussian function out of a spectrum which has five gaussain functions....


@zola1024 wrote:

thank you for the replay Altenbach, but the solutions has to be unique.


I would be unique if you sort the resulting gaussians in order of x position, for example. As mentied earlier, all you need is general linear fit. This is a direct method and not an iterative procedure.

 

(The shipping example to fit three gaussian that has just been mentioned is way overkill for your problem. 🐵

0 Kudos
Message 11 of 29
(3,503 Views)

altenbach is absolutely right. When I suggested an optimizing routine, I wasn't thinking through things sufficiently to realize that you had enough data and few enough unknowns that you could just do a simple fit. The only "hard" part here is to straighten out in your mind just how the fit is exactly analogous to the usual y = mx+b exercise, but that's the important part (for you). Take his advice and run with it, and you will have everything solved before lunch is over.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 12 of 29
(3,489 Views)

zola1024 wrote:

i have attached  the expermental data set, above 

the number of gaussian curves is four.

center positons: 3224, 3280, 3480, 3518 and variances 82.8, 64, 40 , 40  respectivily. and i want the height of this gaussian functions. 


There is no way that the above data can be fit to four gaussians as stated. The width of the real data is orders of magnitude larger.

Can you attach a new datafile that corresponds to these four gaussians (earlier, you said five gaussians).

0 Kudos
Message 13 of 29
(3,477 Views)

In the meantime, here's how you would use general linear fit to get the four amplitudes.

 

It simulates noisy data, then tries to fit to get the amplitudes.

 

 

 

 

 

EDIT: Sorry, there was a formula error in the previous version. I replaced with a corrected version.

Download All
Message 14 of 29
(3,470 Views)

Altenbach, you are right there is a fifth data but it appears on some spectrums and it doesn't on some others. and its width varies and it is not fixed.

but its position is at 3657. and about the four gaussians i make it to read the spectrum file and extract the gaussian, but seems like not much results for me.

I am a newbie in Labview.

I hav attached the file i tried. please take a look at it. looking to hear from you soon.

 

Thank you very much.

0 Kudos
Message 15 of 29
(3,417 Views)

If the width is a fittable paramter, you need a nonlinear fit. You need to be more specific with the problem description. Are the positions fixed or also adjustable?

0 Kudos
Message 16 of 29
(3,400 Views)

width can have some tolerances for the four widths but for the fifth it is adjustable. So i think we can say the whole gaussian functions are also adjustable.

0 Kudos
Message 17 of 29
(3,387 Views)

A single Gaussian is defined by 3 parameters: position, width, amplitude. With four gaussians, we thus have 12 parameters. At this point, you need to define the exact problem. Are the positions exactly known?

0 Kudos
Message 18 of 29
(3,372 Views)

They are like the widths, due to some errors from the measurement of the spectrum, they can have tolerance also.

0 Kudos
Message 19 of 29
(3,370 Views)

Here is a levenberg marquardt implementation that fits an unlimited number of gaussians. (Just add more rows to the guess array)

 

I cannot attach zip files, so make sure to have the model subVI in the same folder.

 

You probably need to tweak the guesses for a more reasonable result. Modify as needed.

 

 

Message 20 of 29
(3,340 Views)