Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Troubles in NonlinearFit-Why always failed?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65913] Troubles in NonlinearFit-Why always failed?
  • From: "simon yang" <yanshanguke at 163.com>
  • Date: Sun, 23 Apr 2006 06:17:16 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Dear Everyone,

I Try to fit a data table with a step function: Epsilon2[x] with
parameters: A, E0, GamaLorentz,  Eg, Ep, Eu, Et, E1

Epsilon2[x_] := If[x>=Et, Gc[x] * L[x], (E1/x) Exp[(x-Et)/Eu]]
Gc[x_] := (x-Eg)^2 / ((x-Eg)^2 + Ep^2)
L[x_] := (A * E0 * GamaLorentz * x) / ((x^2 - E0^2)^2 + GamaLorentz^2 *
x^2)

NonlinearRegress[data,

Epsilon2[x],{x},{{A,80},{E0,2.8},{GamaLorentz,2.2},{Eg,1.7},{Ep,0.9},{Eu,
      0.05},{Et,1.8} ,{E1,5.8}}]

but error messages always display though the starting value of the
parameters is same to these from articles, such as
\!\(\*
  RowBox[{\(FindFit::"lstol"\), \(\(:\)\(\ \)\), "\<\"The line search \
decreased the step size to within tolerance specified by AccuracyGoal
and \
PrecisionGoal but was unable to find a sufficient decrease in the norm
of the \
residual.  You may need more than \\!\\(MachinePrecision\\) digits of
working \
precision to meet these tolerances. \
\\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\",
ButtonStyle->\\\"RefGuideLinkText\
\\\", ButtonFrame->None,
ButtonData:>\\\"FindFit::lstol\\\"]\\)\"\>"}]\)

The data is:
1.5	0
1.5561	0
1.6121	0
1.7057	0.303
1.7805	0.303
1.8927	0.303
1.9676	0.6061
2.0239	1.2121
2.0988	1.5151
2.1552	2.1212
2.2117	3.0303
2.3053	3.3333
2.3619	4.5455
2.4373	5.7576
2.5125	6.6667
2.5316	7.5758
2.6068	8.4848
2.6824	10.303
2.7576	11.2121
2.8142	12.4242
2.8707	13.3333
2.9275	14.8485
2.9656	16.3636
3.0035	17.5758
3.1161	18.4848
3.1355	20
3.1923	21.5152
3.2678	23.0303
3.3806	24.5455
3.4749	26.3636
3.5316	27.5758
3.644	28.1818
3.7563	28.4848
3.8311	28.4848
3.9431	28.1818
4.0176	27.5758
4.1291	26.3636
4.1848	25.4545
4.2403	24.2424
4.3146	23.3333
4.389	22.4242
4.4446	21.5152
4.5377	20.6061
4.5933	19.697
4.6675	18.4848
4.7233	17.8788
4.779	16.9697

The code
\!\(Gc[xE_] := \((xE - Eg)\)\^2\/\(\((xE - Eg)\)\^2 + Ep\^2\)\)
\!\(L[xE_] := \((A\ E0\ GamaLorentz\ xE)\)/\((\((xE\^2 - E0\^2)\)\^2 +
          GamaLorentz\^2\ xE\^2)\)\)
\!\(Epsilon2[xE_] :=
    If[xE \[GreaterEqual] Et, Gc[xE]*L[xE], \(E1\/xE\) Exp[\(xE -
Et\)\/Eu]]\)
<<Statistics`NonlinearFit`

NonlinearRegress[dataE2,

Epsilon2[x],{x},{{A,80},{E0,2.8},{GamaLorentz,2.2},{Eg,1.7},{Ep,0.9},{Eu,
      0.05},{Et,1.8} ,{E1,5.8}}]

(*E1 was used to made the function continuous :
E1=Et*Gc[Et]*L[Et]
but it made the fit more complicated, so I set it as a fitting
parameter *)

Thx

Simon


  • Prev by Date: Re: setps problem/how to set matrix elements
  • Next by Date: Re: How to remove extra empty lines generated when exporting to HTML?
  • Previous by thread: Re: matrix operations -- shared data vs copied
  • Next by thread: Re: Troubles in NonlinearFit-Why always failed?