1''
1''

Reputation: 27095

Matlab custom curve fitting fail

I'm using cftool for a custom fit of Mössbauer spectroscopy data. There are two coefficients, Gamma and N0.

N = f(v)
  = (299792458000^2*Gamma^2*N0)/(299792458000^2*Gamma^2+4*v^2*(4.29383292e-15)^2)

Using default settings (Trust-region, robust off, etc.) I get the following fit:

Fit computation did not converge:
Fitting stopped because the number of iterations or function evaluations exceeded the specified maximum.

Fit found when optimization terminated:

General model:
     f(v) = (299792458000^2*Gamma^2*N0)/(299792458000^2*Gamma^2+4*v^2*(4.29383292e-
                    15)^2)
Coefficients (with 95% confidence bounds):
       Gamma =      0.9137  (-Inf, Inf)
       N0 =   2.454e+04  (2.059e+04, 2.849e+04)

Goodness of fit:
  SSE: 6.41e+11
  R-square: -2068
  Adjusted R-square: -2073
  RMSE: 4.013e+04

Warning: A negative R-square is possible if the model does not contain a constant term and the fit is poor (worse than just fitting the mean). Try changing the model or using a different StartPoint.

If I switch to Levenberg-Marquardt, I get a straight line through the data:

General model:
     f(v) = (299792458000^2*Gamma^2*N0)/(299792458000^2*Gamma^2+4*v^2*(4.29383292e-
                    15)^2)
Coefficients (with 95% confidence bounds):
       Gamma =       0.793  (-Inf, Inf)
       N0 =   6.456e+04  (6.447e+04, 6.465e+04)

Goodness of fit:
  SSE: 3.098e+08
  R-square: 2.22e-16
  Adjusted R-square: -0.002513
  RMSE: 882.3

enter image description here

Why is this failing so badly in both cases?

Upvotes: 0

Views: 1997

Answers (1)

user1860611
user1860611

Reputation: 529

f(v) simplifies to f(v)=N0/(1+(2.8645e-26*(v/Gamma))^2) so the 1 in the denominator dominates until (v/Gamma) starts getting as big as 10^25. With your Gamma of 0.793 and your v of |15| I think matlab might have a hard time of converging to anything other than N0

Upvotes: 1

Related Questions