06-21-2013 11:11 AM - edited 06-21-2013 11:12 AM
@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. 🐵
06-21-2013 12:20 PM
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
06-21-2013 01:33 PM - edited 06-23-2013 10:47 AM
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).
06-21-2013 01:46 PM - edited 06-26-2013 01:33 PM
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.
06-26-2013 04:37 AM
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.
06-26-2013 11:20 AM - edited 06-26-2013 11:21 AM
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?
06-26-2013 11:55 AM - edited 06-26-2013 11:56 AM
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.
06-26-2013 12:22 PM
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?
06-26-2013 12:28 PM - edited 06-26-2013 12:38 PM
They are like the widths, due to some errors from the measurement of the spectrum, they can have tolerance also.
06-26-2013 01:29 PM - edited 06-26-2013 01:29 PM
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.