Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: FindFit & restricting fitting parameter

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55470] Re: FindFit & restricting fitting parameter
  • From: Peter Pein <petsie at arcor.de>
  • Date: Fri, 25 Mar 2005 05:48:12 -0500 (EST)
  • References: <d1turt$riv$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Laurent Feuz wrote:
> Hi
> 
> If I want to fit some data using:
> 
> output = FindFit[data,
>       Izero*(1 + 1/(xiPEG^2*q^2)), {{Izero, 0.12}, {xiPEG, 10}}, q]
> 
> I can assign a starting value to my parameters (like 0.12 for Izero in 
> the above case), but can I also restrict its value to a certain range 
> (like 0.10<Izero<0.14)?
> 
> Thanks for any hints!
> regards
> Laurent
> 
Hi Laurent,

 you can find the parameters using NMinimize:

data = Table[{q, (Random[]/4)*(1 + 1/(q^2*(9 + 2*Random[])^2))},
   {q, -3/4, 5/4, 1/2}];

FindFit[data, Izero*(1 + 1/(xiPEG^2*q^2)),
   {{Izero, 0.12}, {xiPEG, 10}}, q]
==>
{Izero -> 0.151709971352094, xiPEG -> 16.557105919797674}

NMinimize[{
   Plus @@ ((Izero*(1 + 1/(xiPEG^2*#1[[1]]^2)) - #1[[2]])^2 & ) /@ data,
   0.1 <= Izero <= 0.14}, {Izero, xiPEG}][[2]]
==>
{Izero -> 0.14, xiPEG -> 10.107064766466742}

-- 
Peter Pein
Berlin


  • Prev by Date: Upgrading to v5.1?
  • Next by Date: symbolic quaternionic analysis
  • Previous by thread: Re: FindFit & restricting fitting parameter
  • Next by thread: saving data in a new cell