MathGroup Archive 2011

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

Search the Archive

Re: NonlinearModelFit: Freezing parameters

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117484] Re: NonlinearModelFit: Freezing parameters
  • From: Peter Pein <petsie at dordos.net>
  • Date: Sun, 20 Mar 2011 04:53:44 -0500 (EST)
  • References: <im201l$tl$1@smc.vnet.net>

Am 19.03.2011 11:20, schrieb dg:
> Hello,
> is there an easy way to disable the fitting of some of the parameters
> (and force them to some constant value) in NonlinerModelFit?
>
> I searched the documentation and online and could not find anything.
>
> Obviously I am looking for something different from just having to
> change the model by removing the parameters I want to be constant
> every time.
>
> Thanks.
>

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



  • Prev by Date: Re: Wolfram, meet Stefan and Boltzmann
  • Next by Date: Re: Mathematica 8 bug (related to Graph[])
  • Previous by thread: NonlinearModelFit: Freezing parameters
  • Next by thread: Re: NonlinearModelFit: Freezing parameters