Re: Fitting a function to a list (newbie)

*To*: mathgroup at smc.vnet.net*Subject*: [mg21884] Re: Fitting a function to a list (newbie)*From*: "Hans Michel" <hans at dorsai.org>*Date*: Wed, 2 Feb 2000 22:54:40 -0500 (EST)*References*: <872jej$civ@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Math Prof wrote <mathprof at bigfoot.com> wrote in message news:872jej$civ at smc.vnet.net... > I'm new to Mathematica 4.0, so I apologize if this question is overly > trivial (and please let me know if there's a place for trivial > question). > > I have a list that I'd like to fit to the function: > > A + B*Sin[C*x+D] > > In other words, I'd like to find the (approximate numeric) values of > A,B,C,D that yield the best fit to my data. > > I tried using Fit[], but it only applies to linear combinations of > functions, and couldn't optomize the values of C and D. > > For this specific problem, I'm guessing some sort of Fourier transform > might work, but I'm interested in a more general solution -- for example > if Sin[] were replaced with a more complicated function. > > Any help appreciated! > > > Sent via Deja.com http://www.deja.com/ > Before you buy. > I don't have an example for you but I would suggest checking a copy of Exploring Mathematics With Mathematica by Theodore Gray and Jerry Glynn Chapter 14 Fourier for Sound Page 240-251 may be relevant. The version off my shelf is from 1991. In any case some of the functions they wrote are available in MathSource. [NicerFourier and Resample (with some caveats i.e., x values must range between 0 and 2Pi)] Also I would suggest looking into NonlinearFit Statistics`NonlinearFit` And also Using the Help file.