キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

2d Gaussian Fit Problem.

解決済み
解決策を見る

I am having problems in fitting a 2d gaussian curve.

 

I have a set of data: with 3 columns and N rows. For example 

x    y    Intensity.

..   ..      ..

N is same for all 3 columns. I am trying to create an intensity plot out of this data and fit a 2D gaussian to it. 

 

I tryed making a polynomial interpolation of the intensity data over the x-y range and make an intensity plot (Don't know if there is a better way of doing it ! Please Suggest if there is any other way.).

 

Then I use Levenberg-Marquardt method to fit this data. For some reason, it is not doing any iteration with the initial guess. The best fit value is same as initial guess. it is shoing error: NI_Gmath.lvlib:LM get new coefficients.vi:1. (see attached vis)

 

Can anyone help me with this !

 

Thanks.

0 件の賞賛
メッセージ1/24
16,337件の閲覧回数

You don't need to interpolate the data into a regular grid, all you need is fit for the existing points.

 

Have a look at my old example here (look for the "random" option.

 

Your attachment is missing quite a few subVIs. can you attach them too? Thanks!

0 件の賞賛
メッセージ2/24
16,329件の閲覧回数
解決策
受理者 babu126

OK, I quickly modified my old example and it seems to easily fit your raw data. See attached (LV2010). Modify as needed.

 

(Note that I define the width as "width at half heigh", your definition might differ.)

 

 

すべてをダウンロード
メッセージ3/24
16,324件の閲覧回数

The new gaussian peak fit vi has several nice features such as choice of fitting algorithm, entering pre-determined parameters or bounds, etc.  Would it be possible to use it in your gaussian fit program and if so, could you show how to make the modification?

 

Thanks, very useful and efficient code!

0 件の賞賛
メッセージ4/24
15,831件の閲覧回数

@Tim_W wrote:

The new gaussian peak fit vi has several nice features such as choice of fitting algorithm, entering pre-determined parameters or bounds, etc.  Would it be possible to use it in your gaussian fit program and if so, could you show how to make the modification?



Which "new gaussian peak fit" are you talking about?

You would enter paramter guesses in the controls already given.

If you want to set paramter bounds, substitute Constrained Nonlinear Curve Fit VI and add a control for the additional inputs.

What other fitting algorithms do you have in mind?

0 件の賞賛
メッセージ5/24
15,822件の閲覧回数

Under Math VI\Fitting VI\Gaussian Peak VI.  I'm not sure how new it is-it's new to me, but may have been around for awhile.

0 件の賞賛
メッセージ6/24
15,819件の閲覧回数

@Tim_W wrote:

Under Math VI\Fitting VI\Gaussian Peak VI.  I'm not sure how new it is-it's new to me, but may have been around for awhile.


This is only for a plain 1D gaussian, not 2D as in my example above.

 

The "Constrained Nonlinear Curve Fit" mentioned above also has inputs for the "method", so you should be able to do whatever you want (method, paramter bounds, etc.) once you supply a model.

0 件の賞賛
メッセージ7/24
15,814件の閲覧回数

Actually, because I couldn't manege how to use your .vi, I did an other post with the same question and another one.

0 件の賞賛
メッセージ8/24
15,793件の閲覧回数

@MateusV wrote:


What is "not loading"? Can you be more specific?

 

We should keep all this in one place, so let's continue the discussion here.

0 件の賞賛
メッセージ9/24
15,784件の閲覧回数

Dear 

 

I come across your post and I  tryied it on with my spot image after replacing your simaluted data with the 2d image.

 

but I could not get it to work.   did I miss something or not use it correctly?

 

attached please find the test code.  would very appreciate your help.

 

cheers

 

xg

 

 

0 件の賞賛
メッセージ10/24
15,065件の閲覧回数