       Interpolation of data to form a parametric curve

• To: mathgroup at smc.vnet.net
• Subject: [mg80382] Interpolation of data to form a parametric curve
• From: Hugh <h.g.d.goyder at cranfield.ac.uk>
• Date: Mon, 20 Aug 2007 06:06:05 -0400 (EDT)

```Below I give some example data for a 2D curve. I then interpolate the
x and y data to give a parametric version of the curve. This works
well as the plot shows, and I could also use the Spline package.
However, this data is parameterized with respect to point number while
I need the data parameterized with respect to distance along the curve
or alternatively as a distance going from 0 to 1. I can see how to get
distance in terms of point number, by using NDSolve, but how do I get
the inverse -point number in terms of distance? If I have point number
in terms of distance then presumably I can rework the interpolation as
a new function. Any suggestions?
Thanks
Hugh Goyder

d = {{0., 1.2}, {0.180347569987808,
1.1598301273032612}, {0.31554453682333494,
1.0539181001894673}, {0.37759261784475534, 0.9204838518536992},
{0.3662469376233495, 0.8067797622536416}, {0.3090169943749474,
0.7510565162951535}, {0.2505675022261833, 0.767973087013262},
{0.23556798830604195,
0.8430236535910302}, {0.2915423708426846,
0.938110078918853}, {0.418269744520502, 1.0061313243770045},
{0.5877852522924731, 1.0090169943749474}, {0.7549810402071845,
0.9323166416507785}, {0.8747584091877195, 0.7907720262964009},
{0.9191799306804422, 0.6227437070536992}, {0.8880702932342837,
0.4756205908737}, {0.8090169943749471, 0.387785252292473},
{0.7267708750435204, 0.37402339610400703}};

nn = Length[d];

fx = Interpolation[d[[All, 1]]];
fy = Interpolation[d[[All, 2]]];

ParametricPlot[{fx[n], fy[n]}, {n, 1, nn},
Epilog -> {Point[#] & /@ d}, AspectRatio -> Automatic]

(* Get distance in terms of point number *)

dfx = Derivative[fx]; dfy = Derivative[fy];

sol = NDSolve[{Derivative[n][t] == Sqrt[dfx[t]^2 + dfy[t]^2],
n == 0}, {n}, {t, 1, nn}];

```

• Prev by Date: Re: But is it worth to use Mathematica ?
• Next by Date: Missing information in Mathematica 6.0 Documentation
• Previous by thread: Comparison of Mathematica on Various Computers
• Next by thread: Re: Interpolation of data to form a parametric curve