Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*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 2001

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

Search the Archive

Re: How can I find the closest distance between a specified point and an interpolation curve?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27272] Re: How can I find the closest distance between a specified point and an interpolation curve?
  • From: "Rasmus Debitsch" <debitsch at zeiss.de>
  • Date: Sat, 17 Feb 2001 03:30:44 -0500 (EST)
  • References: <96is0i$dg6@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hello,

you can try FindMinimum:

Pointset = {
    {0, 0}, {1, 1}, {3, 4}, {4, 5}, {6, 8},
    {7, 12}, {8, 15}, {12, 30}
};
Fc = Interpolation[Pointset];
pt = {5, -5};

res = FindMinimum[(p = {x, Fc[x]} - pt; Sqrt[p . p]),  {x, {0, 1}}]

Out[32]=  (12:43:04 on 2/16/01)
{7.02196, {x -> 0.333778}}

ps = {x, Fc[x]} /. res[[2]]
Out[16]=  (12:39:40 on 2/16/01)
{0.333778, 0.247309}

Plot[Fc[x], {x, 0, 5.2},
    Epilog -> {PointSize[0.02],
        RGBColor[1, 0, 0], Point[pt],
        RGBColor[0, 1, 0],  Point[ps]
    },
    PlotRange -> {-5.5, 5.5},
      AspectRatio -> 1
]

--

        Rasmus Debitsch
        Carl Zeiss Lithos GmbH
        Carl Zeiss Strasse
        D-73447 Oberkochen

        eMail : debitsch at zeiss.de

"liwen liwen" <gzgear at yahoo.com> schrieb im Newsbeitrag
news:96is0i$dg6 at smc.vnet.net...
> Dear friends,
> Here is a curve that is produced by
> Interpolation[PointSet] function,
> Pointset={{0,0},{1,1},{3,4},{4,5},{6,8},{7,12},{8,15},{12,30}}.
>
> Fc=Interpolation[PointSet].
> the specified point is:
> pt={5,-5}
> I want to find the closest distance between the point
> of pt and Fc ?
>
> Please help!
>
> Best regards,
>              Liwen    2/15/2001
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35
> a year!  http://personal.mail.yahoo.com/
>
>




  • Prev by Date: Re: matrices & polynomials in mathematica
  • Next by Date: Re: two y-axis
  • Previous by thread: Re: How can I find the closest distance between a specified point and an interpolation curve?
  • Next by thread: Re: How can I find the closest distance between a specified point and an interpolation curve?