Re: fitting multiple datasets

*To*: mathgroup at smc.vnet.net*Subject*: [mg58005] Re: fitting multiple datasets*From*: dh <dh at metrohm.ch>*Date*: Thu, 16 Jun 2005 05:36:07 -0400 (EDT)*References*: <d8oumk$n$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Hi Nate, Question1: You could e.g. add an additional first coordinate x0 to your data points, that indicates the data set, and define f (I call the known parameters a and b and the unknown p1,p2,p3): f[x0_,x_,p1_,p2_,p3_]:=Which[ x0==1, f[x,a1,b1,p1,p2,p3], x0==2, f[x,a2,b2,p1,p2,p3], x0==3, f[x,a3,b3,p1,p2,p3], x0==4, f[x,a4,b4,p1,p2,p3], x0==5, f[x,a5,b5,p1,p2,p3] ] Then you would call FindFit: FindFit[data,f[x0,x,x2,x3,x4,x5],{p1,p2,p3},{x0,x}] Question2: for contstrained optimization you could use NMinimize sincerely, Daniel Nate Traaseth wrote: > I have two questions, > > > 1) I have multiple datasets, and one function that depend on multiple > parameters, of which I would like to find a global best fit to three of the > parameters. However, within each dataset, I need to specify slightly > different parameters within the function. For example (not actual function > and will not make sense), > f(a_,b_,c_,d_,e_) = a*x^5 + b*x^4 + c*x^3 + d*x^2 + e*x > In datasets 1-5, I would like to specify different "a" and "b" values (for > each dataset), while finding the best single fit (global) for "c," "d," and > "e" in the function using all datasets. > > I see that using "FindFit" one can enter multiple points of the same > dataset, and minimize the parameters of a function to best fit one dataset, > but is it possible to enter multiple datasets and find a global minimum for > multiple parameters in a function? Or do I need to write my own loop in > Mathematica? > > > 2) When I am doing a minimization using "FindFit" how do I tell the > minimization routine that I am only interested in solutions (assuming they > exist as local minima) that satisfy a certain range. For example, a > solution to a parameter that is only within the range {a,b}. > > > > thanks > Nate > >