MathGroup Archive 2012

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

Search the Archive

Re: Simultaneous Nonlinear Data Fits

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126618] Re: Simultaneous Nonlinear Data Fits
  • From: basarir <basarir at gmail.com>
  • Date: Fri, 25 May 2012 04:58:34 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <hpuu02$lm4$1@smc.vnet.net>

Dear All, 

Here is an implementation of Daniel Lichtblau's algorithm using partial code from Daniel Huber. This way you could also compare the two methods. Hope this helps.
Cheers, 
Basarir

d1 = Table[Exp[-0.02 (x - 30)^2], {x, 100}];
d2 = Table[Exp[-0.02 (x - 70)^2], {x, 100}];
d3 = Table[Exp[-0.02 (x - 50)^2], {x, 100}];
ones = Table[1, {100}];
xs = Range[100];

data = Join[Transpose[{xs, ones, d1}], Transpose[{xs, 2*ones, d2}],Transpose[{xs, 3* ones, d3}]];

mod1[Params_]:= Exp[Params[[1]]* (x - Params[[2]])^2];

modtotal[index_, x1_, x2_, x3_, a_]:= KroneckerDelta[index - 1]*mod1[{a, x1}] + KroneckerDelta[index - 2]*mod1[{a, x2}] + KroneckerDelta[index - 3]*mod1[{a, x3}];

sol = NonlinearModelFit[data, modtotal[index, x1, x2, x3, a], {{x1, 20}, {x2, 60}, {x3, 40}, {a, -0.001}}, {x, index}];

sol["BestFitParameters"]
sol["RSquared"]

Result:

{x1 -> 30., x2 -> 70., x3 -> 50., a -> -0.02}
1.
 





  • Prev by Date: how to compute mass data?
  • Next by Date: 'Nother Inverse Function Question
  • Previous by thread: Re: how to compute mass data?
  • Next by thread: 'Nother Inverse Function Question