From: "John D'Errico" <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: distance between two points along a curve
Date: Sat, 8 May 2010 13:04:05 +0000 (UTC)
Organization: John D'Errico (1-3LEW5R)
Lines: 33
Message-ID: <hs3ng5$g6u$>
References: <hs3e0d$cht$> <hs3f5t$qh4$> <hs3g9h$7u4$> <hs3iir$49g$>
Reply-To: "John D'Errico" <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1273323845 16606 (8 May 2010 13:04:05 GMT)
NNTP-Posting-Date: Sat, 8 May 2010 13:04:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: comp.soft-sys.matlab:633740

"Roger Stafford" <> wrote in message <hs3iir$49g$>...
> "Luca Turchet" <> wrote in message <hs3g9h$7u4$>...
> > Dear Bruno,
> > thanks a lot.
> > 
> > The problem is that I need to calculate the x,y coordinates of the point which is at a given distance from another point along the curve.
> > 
> > Let´s say A = (x1, f(x1)) where f = normal distribution
> > I need to find B = (x2, f(x2)) such that the distance between A and B is equal to a specified value, for example 2.
> > 
> > Do you have any idea how to do this?
> - - - - - - - - -
>   As a suggestion, use the function 'cumtrapz' with the integrals suggested by Bruno and Torsten with sufficiently close spacing of points starting at point A to give the accuracy you need with trapezoidal integration.  Then your task is to locate within the 'cumtrapz' vector result, that value that first exceeds the desired distance.  The 'find' function with an inequality can help you do this.  Then in the last interval you can make an appropriate linear adjustment to locate the point B within it accurately.
>   This might be less time consuming than using 'fzero' which would require numerous repeated integrations all starting back at point A.
> Roger Stafford

Another option is to use ode45. It can integrate
the arclength term. Then set it so that it finds the
specific arclength that you need. This is actually
the best way to solve the problem. For more details,
look at my arclength and interparc codes on the
file exchange. interparc does a spline arclength

Alternatively, you could just sample the Gaussian
curve and then call one of these codes.

Of course, since this is surely for homework, neither
alternative is probably an option.