Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10207

Re: Simultaneous Nonlinear Data Fits

From basarir <basarir@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Simultaneous Nonlinear Data Fits
Date 2012-05-25 09:01 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jpnhou$qc6$1@smc.vnet.net> (permalink)
References <hpuu02$lm4$1@smc.vnet.net>

Show all headers | View raw


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.
 


Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Simultaneous Nonlinear Data Fits basarir <basarir@gmail.com> - 2012-05-25 09:01 +0000

csiph-web