LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

use Nonlinear Curve Fit LM for Possion type fitting

Hi, guys,

I am using "Nonlinear Curve Fit LM" for a Poisson type distribution.

The Possion equation is f(x)=a^x*exp(-a)/ x!

Where x! is factorial of x.

How to write this equation to F(x,a) input?

Thanks for help!

Raymond


0 Kudos
Message 1 of 6
(4,335 Views)
This will not work, because the factorial function is only defined for non-negative integers of x.
 
Levenberg-Marquardt fittiing requires that f(x) is a Continuous_function over the useful range of values.
 
What is the range of X? If X is typically very large, you could maybe substitute Stirling's approximation for the factorial.
0 Kudos
Message 2 of 6
(4,330 Views)

Actually, Stirling's approximation is pretty good for all positive inputs.

Here's a quick implementation of your function using the VI model (See insert)

Works pretty well. What is your LabVIEW version?



Message Edited by altenbach on 05-12-2008 05:15 PM
0 Kudos
Message 3 of 6
(4,324 Views)

A nice posting, thanks a lot!
I almost get there, but I still have problem to link this subvi to “Nonlinear Curve Fit LM” , I’m not familiar with reference node at all, Could you throw me a little further hint? I am using Labiew 8.5 and the X set range is about 200~300.

0 Kudos
Message 4 of 6
(4,304 Views)


up_horn wrote:
 I am using Labiew 8.5 and the X set range is about 200~300.

Well, then it won't work. The factorial part will overflow the DBL range at about half that.
 
If your x range is 200-300, your "a" is also in that range. For large "a", you should use a Gaussian centered at "a" and with a variance of "a". See http://en.wikipedia.org/wiki/Poisson_distribution for details (Secton: related distributions).
 
Here is the version for the Stirling's approximation. See if you can modify it for the gaussian approximation. 🙂
 
 
 

 
0 Kudos
Message 5 of 6
(4,291 Views)
Yeh, Gaussian works well, just want to try something else, I might need to sparse my X array set, use your subvi and then draw the fitted line.
Thanks agian.

0 Kudos
Message 6 of 6
(4,267 Views)