MathGroup Archive 2011

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

Search the Archive

Re: Using Fit[] inside Plot[] function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119539] Re: Using Fit[] inside Plot[] function
  • From: Thomas <thomas.a.lanz at gmail.com>
  • Date: Wed, 8 Jun 2011 07:14:58 -0400 (EDT)
  • References: <iskvj7$5pp$1@smc.vnet.net>

On Jun 7, 7:47 pm, twiggy666 <dejanristi... at gmail.com> wrote:
> pt = {{3, a}, {5, b}, {9, c}, {11, d}, {15, e}, {18, f}}
> Plot[Fit[pt, {0, x, x^2, x^3, x^4, x^5, x^6}, x], {x, 0, 18}]
>
> I want to use this type of plot inside a dynamic module (see link to notebook below for full code).
> Doesnt work though.
>  I know i can use InterpolatingPolynomial[] inside Plot[] for similar effect but it doesnt produce the same curve.
>
> This is a link to a notebook with the full code:http://dl.dropbox.com/u/28494067/upg3.nb

If you work with a different argument name in the Plot it works:

DynamicModule[
 {pt = {{3, 7}, {5, 8}, {9, 1}, {11, 1}, {15, 3}, {18, 0}}},
 LocatorPane[
  Dynamic[pt],
  Dynamic[
   Show[
    Plot[Fit[pt, {0, x, x^2, x^3, x^4, x^5, x^6}, x] /. x -> y, {y, 0,
       18}, PlotStyle -> Brown, PlotRange -> {{0, 18}, {10, -1}}]
    ]
   ]
  ]
 ]

hope this helps.
Regards,
T


  • Prev by Date: Re: Using Cases or Position to Find Strings in a List of Strings
  • Next by Date: Re: Mapping points
  • Previous by thread: Using Fit[] inside Plot[] function
  • Next by thread: replace with closest value