1
$\begingroup$

I have a data:

data = {{1504., 0.38623}, {1698.56, 1.70795}, {1855.34, 4.77922}, {1998.22, 
  9.76965}, {1957.13, 7.34756}, {1924.72, 5.8017}, {1793.82, 
  2.84449}, {1679.68, 1.14792}, {1604.06, 0.765434}, {1422.63, 
  0.183902}, {1350.57, 0.078183}}

And I wanted to fit function

nlm = NonlinearModelFit[data, $\frac{c1}{Exp \left[\frac{c2 \left(\frac{3*10^8}{583.92*10^{-9}}\right)}{x+273.15}\right]-1}$, {c1, c2}, x]

I get warning: ...is too small to represent as a normalized machine number; precision may be lost.

How to fit this function?

$\endgroup$
4
  • 1
    $\begingroup$ Please include the actual code for NonlinearModelFit rather than the display format currently showing and decide if the data set is data or data8. $\endgroup$
    – JimB
    Feb 4, 2022 at 22:01
  • $\begingroup$ Given that 1/Exp[750.] underflows, I'm not surprised, given the argument in your model. You might consider giving starting values, esp. for c2. $\endgroup$
    – Michael E2
    Feb 5, 2022 at 3:58
  • $\begingroup$ @MichaelE2 The idea of starting values works. $\endgroup$ Feb 6, 2022 at 20:44
  • $\begingroup$ Using anything between 10^-20 to 10^-10 as a starting value for c2 works. But it is simpler if you use c1/(Exp[c0 /(x + 273.15)] - 1) as the model and then solve for the appropriate multiple of c0 to get c2 because the default starting values work fine in that case. $\endgroup$
    – JimB
    Feb 6, 2022 at 22:51

1 Answer 1

1
$\begingroup$

I guess, there is simpliy a typo with 583.92 10^-9 Get good result with positive exponent

model[x_] = c1/(Exp[(c2 ((3 10^8)/(583.92 10^9)))/(x + 273.15)] - 1)

nlm = NonlinearModelFit[data, model[x], {c1, c2}, x]

Normal[nlm]

(*   1.50253*10^6/(-1 + E^(27202./(273.15+ x)))   *)

Plot[Normal[nlm], {x, 1300, 2000}, Epilog -> Point@data]
$\endgroup$
1
  • $\begingroup$ The value 583.92 10^-9 is a wavelength in nanometers ($10^{-9}$ m) $\endgroup$ Feb 5, 2022 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.