Re: NonlinearModelFit: Freezing parameters
- To: mathgroup at smc.vnet.net
- Subject: [mg117515] Re: NonlinearModelFit: Freezing parameters
- From: dg <davide.guarisco at gmail.com>
- Date: Mon, 21 Mar 2011 06:16:19 -0500 (EST)
- References: <im201l$tl$1@smc.vnet.net> <im4iru$d29$1@smc.vnet.net>
On Mar 20, 2:54 am, Peter Pein <pet... at dordos.net> wrote: > > Hi, > > you can wrap a Block[] around the call to NonlinearModelFit (NMF). You > just have to change the way how the parameters are given to NMF using > Variables: > > In[1]:= model=a0+a1 x+a2 x^2; > data=Table[{x,.25+x^(3/2)},{x,0,2,1/3}]; > > the normal call to NMF: > In[3]:= f0=NonlinearModelFit[data,model,Variables[{a0,a1,a2}],x]//Normal > Out[3]= 0.22546 + 0.601959 x + 0.416822 x^2 > > Say you knew a0=1/4: > > In[4]:= f1=Block[{a0=.25}, > NonlinearModelFit[data,model,Variables[{a0,a1,a2}],x]//Normal > ] > Out[4]= 0.25 + 0.557096 x + 0.434077 x^2 > > hth, > Peter Peter, that's a neat trick. I think this does not work with models that are not polynomials. For example, model= c0*Sin[c1*x].