LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Nonlinear Curve Fit (Black-body radiation distribution)

Solved!
Go to solution

Hi,

 

In my measurements I would like to estimate temperature from the spectra of emitted light by means of Planck's law of black-body radiation distribution. I was trying to fit my data with Nonlinear Curve Fit, but I met with couple of problems:

 

    1.) Function is not fitting properly, because of different fitted data distribution shape and values from data input.

    2.) When plotting Planck's distribution using best fit parameter, plot is different from theoretical distribution of given temperature. (My data are from source of temperature 3100K, best fit parameter is 1130K, but fit is different from theoretical distribution of 1130K)

 


 

 

When I fit some simple equations, everything works, so I'm not sure what could be a problem

 

Thanks a lot for any advice.

 

Ivan

 

 

Message Edited by Support on 03-02-2009 09:17 AM
0 Kudos
Message 1 of 8
(7,583 Views)

Hi wacker!

 

Could you possibly clarify what you mean by "different fitted data distribution shape and values from data input?"  

 

Also, is the smaller picture showing the theoretical distribution?  

 

How different are the simple equations that you got to work for you?  Can you isolate the issue to one particular aspect of the code?

 

Kristen H.

0 Kudos
Message 2 of 8
(7,559 Views)

You have a serious dataflow issues and race conditions due to overuse of value properties. You also have a wild mix of EXT, DBL, and SGL. You should do everything in DBL. (You don't want any red dots, so fix the representations, incl. the diagram constants).

 

As a first step, you should eliminate ALL value properties and wire everything together. You have 5 code "islands" with no data depedency and there is this no guarantee that A and B will get correct values before their value property are read inside the inner loop.

 

So, as a first step fix all that (e.g. as in the attached image) and let's go from there. 🙂

 

Also note that "index array is resizeable for multiple outputs. It seems silly to transpose and then slice out columns instead of simply slicing out rows.
Message Edited by altenbach on 02-27-2009 09:02 PM
0 Kudos
Message 3 of 8
(7,551 Views)
Solution
Accepted by topic author wacker

Quickly looking once more over this, it seems to me that one of your constants if four orders of magnitude off.

 

You get a pretty good fit with 3.74177E-16 instead of 3.74177E-12, see image. (You divide your theoretical curves by 10000, but you don't do so in your formula!)

 

 

Message Edited by altenbach on 03-01-2009 07:55 PM
0 Kudos
Message 4 of 8
(7,528 Views)

Hi Kristen,

 

I'm sorry..as soon as I posted my question, I realized that there is a mistake in my model equation, so now it looks all right. Thanks for the promt answer.

 

Ivan 

0 Kudos
Message 5 of 8
(7,510 Views)
Thank you altenbach for useful tips! 😉
0 Kudos
Message 6 of 8
(7,509 Views)
Yes! You are right, I realized it after posting my question, but thanks a lot! It is a lesson for me to take a think of the problem a bit longer before posting questions 🙂
0 Kudos
Message 7 of 8
(7,505 Views)

Thanks for sharing the code - I've had a use for it and wanted to mention a few things - the factor of 10000 probably results from expressing the speed of light in cm/s instead of m/s. Notice that the the formula and the code are different - the formula is 2hc^2 while the code is 2pihc^2.  Adding the pi to the expression converts it from spectral radiance to spectral radiant exitance. The latter is the more common form.

0 Kudos
Message 8 of 8
(5,845 Views)