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: 

2-D nonlinear curve fitting

OK, the Gaussians in the x and y direction are the same, but both are asymmetric, with a different width on each side. (in the more general case, you would need four widths)

 

Here's my 5 minute modification (fitsurface4.zip). See if it works for you. I am not sure if it is exactly what you want. (there are probably bugs)

 

Since there is significantly more asymmetry now, there are probably local minima in the rotation, so you might have to add some more intelligence to get a good angle guess.

(To simulate other data scenarios, make the "guess" array into a control and vary any parameter at will, then look at the middle graph, e.g. fitsurface3.zip) 

Download All
0 Kudos
Message 31 of 63
(3,432 Views)

this same problem is mine  ihave an image of bead and i have to its center ,but cant able to do this i have labview 11

It is not important to know all the answers, what is important is how to find them 😉
0 Kudos
Message 32 of 63
(3,329 Views)

@abhishek_singh wrote:

this same problem is mine  ihave an image of bead and i have to its center ,but cant able to do this i have labview 11


This is not sufficeint information to help you.

What have you tried and what kind of errors did you encounter?

Attach your code and your data so we can see what's wrong.

0 Kudos
Message 33 of 63
(3,324 Views)

Dear Altenbach,

 

First of all like the others here I want to thank you for your tricks which allowed me to build an efficient 2D fitting algorithm for my experimental data. I would now have interest in getting confidence intervals for the different fitting parameters and I was trying to use the built-in labview VI Nonlinear curve fit intervals, but it seems that it does not respond very well to having no X input (unlike the nonlinear fitting VI). I also tried it unsuccessfully with your 2D gaussian fitting code.

 

Do you have suggestions as to how to treat this problem?

 

Thank you very much in advance, 

 

Antoine

0 Kudos
Message 34 of 63
(3,151 Views)

Please disregard the previous message, th eproblem was actually the same as pointed out in the thread http://forums.ni.com/t5/LabVIEW/Non-linear-Fit-Intervals-Gives-Error-20001/td-p/1301484.

 

Thank you nonetheless (you answered that hread too...)

 

 

0 Kudos
Message 35 of 63
(3,124 Views)

Dear altenbach,

Dear All,

thank you for your help on 2D fitting.

I think that the version 2 (FitSurface2.zip ‏40 KB) should be the best approach for my problem.

I have a spot that should be gaussian (it should be better to use a Pseudo Voigt, i.e. something similar to µ*F_gauss + (1-µ)*F_Lorentz) that should be elliptical and rotate.

However, during an experiment I can obtain a saturated image...

In order to not loose all the experimental run, I would like to fit the spot making a mask (or better not fitting the saturated areas). The vi FitSurface2 transform 2D to 1D: in this way it is possible to fit (for each line) only the tails, discarding the saturated points.

 

But, how I can do it in Labview? (I can do with Origin, Kaleidagraph...)

 

awaitig some helps...

 

dh

0 Kudos
Message 36 of 63
(2,981 Views)

I believe Altenbach's fit is a general 2D non-linear fit to a (more-or-less arbitrary) model.  If you want to fit, but your data is saturated, make a model of "saturated data".  In your case, the model would be min (Gaussian model, Saturated Value).

 

Bob Schor

0 Kudos
Message 37 of 63
(2,951 Views)

Dear Bob,

I'm sorry but I do not understand "make a model of "saturated data" "

 

dh

 

0 Kudos
Message 38 of 63
(2,943 Views)

@Dariush_Hampai wrote:

Dear Bob,

I'm sorry but I do not understand "make a model of "saturated data" "


I am sure that a saturated 2D gaussian can be modeled mathematically, maybe with just one additional parameter that describes the saturation. So simply add one more parameter, rewrite the model subVI according and fit for it.

 

If you have problem with that, please attach some typical data.

 

Is the saturation some nonliear process or is it just an input clipping? Is the saturated value known (e.g. 255, or whatever the Z resolution of the deterctor is)

0 Kudos
Message 39 of 63
(2,937 Views)

Dear Altenbach,

in my attach you may find your example with my saturated image

 

FitSurface2.zip ‏242 KB

0 Kudos
Message 40 of 63
(2,933 Views)