From: Frodo on
Hi all,
I don´t know how to calculate the distance between two points along a curve with a given function.

In particular I need to calculate in MATLAB the x,y coordinates of the point which is at a given distance from another point along the curve.

The curve is the gaussian one (with all the data to specify it).


Thanks in advance!

Cheers
From: Bruno Luong on
"Luca Turchet" <tur(a)imi.aau.dk> wrote in message <hs3e0d$cht$1(a)fred.mathworks.com>...
> Hi all,
> I don´t know how to calculate the distance between two points along a curve with a given function.
>
> In particular I need to calculate in MATLAB the x,y coordinates of the point which is at a given distance from another point along the curve.
>
> The curve is the gaussian one (with all the data to specify it).
>
>
> Thanks in advance!
>
> Cheers

Let x -> f(x) be a "curve"

The distance between (x1,f(x1)) and (x2,f(x2)) on the curve is

integral_(x1,x2) sqrt(1 + df/dx(x)^2) dx.

Use QUAD function to find what you want.

Bruno
From: Torsten Hennig on
> Hi all,
> I don´t know how to calculate the distance between
> two points along a curve with a given function.
>
> In particular I need to calculate in MATLAB the x,y
> coordinates of the point which is at a given distance
> from another point along the curve.
>
> The curve is the gaussian one (with all the data to
> specify it).
>
>
> Thanks in advance!
>
> Cheers

If y=f(x) is the equation for the curve, (a,f(a)) is
the starting point and the point (b,f(b)) with
L = dist((a,f(a));(b,f(b))) along the curve
satisifies b>a, solve
(int_{a}^{b} sqrt(1+f'(x)^2) dx )- L = 0 (1)
for b.
(For b<a solve
(int_{b}^{a} sqrt(1+f'(x)^2) dx ) - L = 0)

Usually this is a nonlinear equation in b such
that b can't be calculated analytically ;
you could use quad to integrate and fzero to get
the root of (1).

Best wishes
Torsten.
From: Luca Turchet on
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?






"Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hs3f5t$qh4$1(a)fred.mathworks.com>...
> "Luca Turchet" <tur(a)imi.aau.dk> wrote in message <hs3e0d$cht$1(a)fred.mathworks.com>...
> > Hi all,
> > I don´t know how to calculate the distance between two points along a curve with a given function.
> >
> > In particular I need to calculate in MATLAB the x,y coordinates of the point which is at a given distance from another point along the curve.
> >
> > The curve is the gaussian one (with all the data to specify it).
> >
> >
> > Thanks in advance!
> >
> > Cheers
>
> Let x -> f(x) be a "curve"
>
> The distance between (x1,f(x1)) and (x2,f(x2)) on the curve is
>
> integral_(x1,x2) sqrt(1 + df/dx(x)^2) dx.
>
> Use QUAD function to find what you want.
>
> Bruno
From: Bruno Luong on
Yes once you are able to compute the length, use FZERO to find where is the second point. Torsen has answered this in other thread.

Bruno