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: fitting a function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58362] Re: [mg58323] fitting a function
  • From: "David Park" <djmp at earthlink.net>
  • Date: Tue, 28 Jun 2005 21:56:56 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Darrell,

First, get rid of the commas in your data.

data = {{10000, .3}, {15000, .5}, {20000, .6}, {25000, .65}};

<< NumericalMath`PolynomialFit`

poly = PolynomialFit[data, 3]
FittingPolynomial[<>, 3]

Plot[poly[x], {x, 10000, 25000},
    Epilog -> {AbsolutePointSize[5], Point /@ data},
    Frame -> True,
    ImageSize -> 450];

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/ 




From: Bosch, Darrell [mailto:bosch at vt.edu]
To: mathgroup at smc.vnet.net



Dear Group,  I have two questions:  First, I want to fit a function
relating utility to income based on some elicited data.  For example,
the following pairs might represent the income and utility values for an
individual:  {10,000, .3}, {15,000, .5}, {20,000, .6}, {25,000, .65}  I
want to fit the data to a function and plot the resulting function.
What is the best way to do this?  PolynomialFit seems like a logical
choice, but it's not clear to me from the documentation how to specify
the command for a series of pairs of points. 



Second, how do I plot the resulting value of a polynomial fit in the
example below?  My 'ParametricPlot' command doesn't do the job.  Thanks
in advance for your help.  Darrell Bosch



<< "NumericalMath`PolynomialFit`"

In[28]:=

p = PolynomialFit[{1, 4, 9,

    16, 25, 36, 49}, 3]

ParametricPlot[p, {p, 0, 6}, PlotRange -> All, Compiled -> True]







  • Prev by Date: Re: Common factors in a list
  • Next by Date: New Visualization - Earthquake data
  • Previous by thread: Re: fitting a function
  • Next by thread: Re: fitting a function