From: S. Ali on
Hi,
I want to draw an arc using just five points, would anyone help me in this case?
also I need the equation of this fitted curve too.

tnx

ALI
From: Roger Stafford on
"S. Ali " <s.mirhadizadeh(a)ymail.com> wrote in message <i02en4$orh$1(a)fred.mathworks.com>...
> Hi,
> I want to draw an arc using just five points, would anyone help me in this case?
> also I need the equation of this fitted curve too.
>
> tnx
>
> ALI

A quartic polynomial is uniquely determined by five points along it. Also a conic section is uniquely determined by five points. I would suppose the number of possibilities of this kind is endless. What kind of "arc" or "equation" do you have in mind?

Roger Stafford
From: S. Ali on
"Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <i02fl2$qie$1(a)fred.mathworks.com>...
> "S. Ali " <s.mirhadizadeh(a)ymail.com> wrote in message <i02en4$orh$1(a)fred.mathworks.com>...
> > Hi,
> > I want to draw an arc using just five points, would anyone help me in this case?
> > also I need the equation of this fitted curve too.
> >
> > tnx
> >
> > ALI
>
> A quartic polynomial is uniquely determined by five points along it. Also a conic section is uniquely determined by five points. I would suppose the number of possibilities of this kind is endless. What kind of "arc" or "equation" do you have in mind?
>
> Roger Stafford


well ,I will try them, and see how its going to look like,
something like not whole Ellipse ,maybe just part of it.

Regards

ALI
From: Roger Stafford on
"S. Ali " <s.mirhadizadeh(a)ymail.com> wrote in message <i02gn7$6bu$1(a)fred.mathworks.com>...
> well ,I will try them, and see how its going to look like,
> something like not whole Ellipse ,maybe just part of it.
> Regards
> ALI

To find the conic section that fits five points you can do the following. Let x and y be 5x1 column vectors of the cartesian coordinates of the five points. Then compute:

[U,S,V] = svd([x.^2,x.*y,y.^2,x,y,ones(size(x))]);
a = V(1,6); b = V(2,6); c = V(3,6);
d = V(4,6); e = V(5,6); f = V(6,6);

These last will be the coefficients of the conic section that contains the five points:

a*x.^2 + b*x.*y + c*y.^2 + d*x + e*y + f = 0

You can use ezplot to display this conic section.

Note that it will turn out to be an ellipse only if the five points are so placed that b^2 < 4*a*c. If b^2 = 4*a*c, it will be a parabola and if b^2 > 4*a*c it will be a hyperbola.

Also note that if you have more than five points, this procedure finds the best-fitting conic section to the points in a least squares sense.

Roger Stafford