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

MathGroup Archive 2007

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

Search the Archive

Re: Using FindFit with constraints ??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75720] Re: Using FindFit with constraints ??
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Wed, 9 May 2007 04:30:54 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <f1ph2r$i1q$1@smc.vnet.net>

Alex wrote:
> Hello everybody,
> 
> I saw at http://reference.wolfram.com/mathematica/ref/FindFit.html
> that FindFit can be used with constraints for the parameters. However
> when I try the example with Mathematica 5.2 I get an error.
> 
> model = a Cos[=CF=89 t];
> data = Table[{t, Cos[2.1 t]}, {t, 0, 10, .25}] + RandomReal[.1, 41];
> fit = FindFit[data, {model, {a > 0, 1 < =CF=89 < 2}}, {a, =CF=89}, t]
> 
> =>
> FindFit::nlnum: The function value {-1. + Cos[RandomReal[0.1, 41.]] -
> \
> 1=2E\RandomReal[0.1, 41.], \[LeftSkeleton]9\[RightSkeleton], \
> [LeftSkeleton]113\
> \[RightSkeleton]} is not a list of numbers with dimensions {123} at
> {a, =CF=89} = \
> {1, 1}.
> 
> 
> What am I doing wrong ??
> 
> Alex
> 
> 

The function RandomReal does not exist in version 5.2. Use

Random[Real, {.1, 41}]

Regards,
Jean-Marc


  • Prev by Date: Re: [Mathematica 6] What happened to the 5.2 HELP interface? Can one get it back?
  • Next by Date: Re: Non-calculus vector math
  • Previous by thread: Re: Using FindFit with constraints ??
  • Next by thread: Re: Using FindFit with constraints ??