Showing results for 
Search instead for 
Did you mean: 

2-D nonlinear curve fitting

@altenbach wrote:

You can use the weight input and set all position that exceed a certain z value to a weight=0. Keem the weight at 1 for the rest of the data.

Here's how to ignore all data that is >3500 by using the weight input.


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 51 of 63

Dariush_Hampai wrote:

If my image is saturated, the fit profile tries to estimate also the flattened interval, over-estimating the FWHM and sub-estimating the Intensity peak

Both of my examples [(1) using the clip level as additional parameter or (2) using the weight to ignore large inputs] will correctly estimate the FWHM. Have you tried?

LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 52 of 63

dear altenbach,

I'm sorry for the delay, but in Italy now is night...

it seems it works as I want, but only on monday I can try with my data (I have it at work...)

my only doubt is that 


width = 2 * sigma


it is right?


thank you for your great help!!!



0 Kudos
Message 53 of 63

I depends how you define "width".


The width at half maximum is approximately 2.355 x sigma (See here for the analytic definition. There's a ln2 and a square-root in there Smiley Wink)


You should change the model to use parameters defined in the desired units. 

LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 54 of 63

it's ok... but in your vi youdefine the "width A" and "wiidth B"... what are the meaning of these parameters?

0 Kudos
Message 55 of 63

One is the width in the direction of the long axis and the other orthogonal to it. remember, there is rotation.


Yes, according to the text in the model, the width are defined as 2 x sigma, so it is not (FWHM). 


You can easily calculate sigma or FWHM from it.

LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 56 of 63
ok... it is the information that I need

thank you again

0 Kudos
Message 57 of 63

Dear Altenbach,


Thank you for the example on the 2D Gaussian fit The VI really helps me much! and those who are involved in the discussion of the gaussian fit, It really helps me to understand and digging for more about gaussian fit. The example which had been given in previous discussion was on single peak gaussian fit. Let's say that i have 2d data which is actually has 2 peaks and I want to apply gaussian fit on the data. What I have done so far, I make some modifications  from the original VI (2DGaussianFitwithRotationforSequenceConstantInput_CA). In the curve fit model I add parameters for the second peak. The original file has 7 parameters and in my case the total parameters has become 14 parameters . However the problem comes to find the highest 2 peaks using the max/min from the array palette. In my case the max/min does not work because it only gives 1 location (x,y) and amplitude of peak data. I tried an example from (Todd_Lesher) in other discussion group and still did not work. Here I attached the 2 peaks 2d data and guide me how can i get the correct results. 



0 Kudos
Message 58 of 63

As a general rule, if you have a New Question/Problem, it is polite and helpful to start a new Thread (perhaps referencing the older thread).


Have you looked at the data that you attached?  To me, it looks like a small section that might be two Gaussians, but over a small enough area that the peak of neither Gaussian is in the picture.  When doing curve-fitting, it is much easier to fit if you have sufficient data to easily "see" one (or more) of the parameters -- in this case, seeing a clear peak in the data (instead of the peaks being "off the paper") would have been a great help in the fitting algorithm.


Bob Schor

0 Kudos
Message 59 of 63

Please attach your data with a more normal filename. Your current file "LBP phantom data x+@-25_(0).txt ‏30 KB" contains characters that are reserved on some systems.

LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 60 of 63