Ask Experts Questions for FREE Help !
Ask
    giusyvenezia's Avatar
    giusyvenezia Posts: 6, Reputation: 1
    New Member
     
    #1

    Nov 29, 2012, 06:04 AM
    Deriving the equation of points for exact fitting and shape analysis
    Hello,

    I would like to ask you some questions.

    1) I've a closed curve (for example an ellipse, which may represent the contour of an object) represented by the set of its (known) points. I need to find the equation of that curve to pass through all and every point (exact fit). I think that to do this I need a polynomial whose grade is equal to the number of points less 1.

    Something like this:

    a0+a1 x1+a2 x1^2+... + an x1^n = y1
    a0+a2 x2+a2 x2^2+... + an x2^n = y2
    ...
    a0+a2 xn+a2 xn^2+... + an xn^n = yn

    This argument is right? Do you have suggestions (or anything else relevant) for me in this regard for which is the best way to solve my problem? This equation can be made in parametric form?

    2) After I got the exact equation of this curve. Suppose we have a set of curves very similar to each other (represented by their equation), I would like to find the equation that represents the shape which best approaches to all previous curves, a sort of average curve created from those previously acquired.
    Do you know if this thing can be done and how? What is the best way (most efficient and / or mathematically more correct) to do this?

    Best Regards,

    Giusy
    ebaines's Avatar
    ebaines Posts: 12,131, Reputation: 1307
    Expert
     
    #2

    Nov 29, 2012, 06:57 AM
    1) You are on the right track, except that if you have 'n' points the number of unknowns (the a's) is also n, and the equation is a polynomial of order n-1, so the matrix of equation is:



    This will give a polynomial solution for a function that passes through all n points. You mentioned an ellipse, but the equation for an ellipse is nt of this form, so the solution using this technique will never result in an ellipse. Which goes to show that there are multiple equations that can be solutions to passing through the n points. And this technique simply finds the polynomial version.

    2) When you ask about "similar" curves I assume you mean that they are all of the same degree (i.e, all of order n-1). One approach would be to simply find the mean of the set of coefficients associated with each power of x. For example suppose you have three equations of the form y=a_0+a_1x+a_2x^2, like this:

    y = 2 + 3x + 3x^2
    y = 1 + 4x + 3x^2
    y = 2 + 5x + 1 x^2

    The mean value of a_0 is 5/3, the mean value for a)1 is 4, and the mean value of a_2 is 7/3. So the resulting "average" equation is 5/3 + 4x + 7/3x^2.
    giusyvenezia's Avatar
    giusyvenezia Posts: 6, Reputation: 1
    New Member
     
    #3

    Nov 29, 2012, 08:23 AM
    Thank you very much for the precious information.

    Do you think that the "Lagrangian Interpolation" is more suitable for my purpose?

    Informally, I need to get the equation (possibly as general as possible and parametric), or any other mathematical stuff, that uniquely (unambiguously) represents a given shape (denoted by its points).

    The function that I need must take into account only (and exactly) the points that belong to my shape and no other. So I cannot use "best fit techniques" like "minimize euclidean distance" of "direct least squares", etc.

    For "similar curves" I wanted to mean, "similar shape". Consider for example, the point's contour of a rugby ball (obtained for example via edge fitting technique, but no matter how). Suppose that I've two (of more) rugby balls (of course, properly scaled and positioned in the Cartesian plane all the same), and suppose that I want to find a way to model and define a rugby ball that is an "average" of the rugby balls previously mentioned.

    I hope I was clear.

    Thanks you again
    ebaines's Avatar
    ebaines Posts: 12,131, Reputation: 1307
    Expert
     
    #4

    Nov 29, 2012, 08:54 AM
    I think the major issue here is that a rugby ball cannot be represented very well by an nth order polynomial. Here's an example to illlustrate this: suppose I have an ellipse defined by:



    and suppose a = 2 and b = 1. The following 3 points are all on that ellipse:

    (0,1)
    (1, 0.866)
    (2,0)

    If I use these values to solve for the coefficients in the equation I get:

    .

    You can see from the attached figure that this parabola doesn't match the ellipse very welll at all.
    Attached Images
     
    giusyvenezia's Avatar
    giusyvenezia Posts: 6, Reputation: 1
    New Member
     
    #5

    Nov 29, 2012, 09:08 AM
    As always, you are right.

    So, do you think that the only thing I could do is to interpolate alle the point of the shape via Lagrangian interpolation?
    giusyvenezia's Avatar
    giusyvenezia Posts: 6, Reputation: 1
    New Member
     
    #6

    Nov 29, 2012, 09:09 AM
    Consider also that the points has a sort of "monotonic" structure as you can imagine from the shape.
    ebaines's Avatar
    ebaines Posts: 12,131, Reputation: 1307
    Expert
     
    #7

    Nov 29, 2012, 09:48 AM
    Lagrangian interpolation will simply give you the nth order polynomial that we've been talking about. I think if you take enough data points the method can give a pretty good approximation; it's just not going to be exact. Attached you can see what happens if you approximate the ellipse by 2nd order, 4the order, an 8th order polynomials - it gets pretty good within the range of points measured.
    Attached Images
     
    giusyvenezia's Avatar
    giusyvenezia Posts: 6, Reputation: 1
    New Member
     
    #8

    Nov 29, 2012, 10:14 AM
    Thank you, you are always very clear.

    Yes, it seems that the approximation is very good with the growth of the points to be interpolated (consider that in my cases there are a lot the points, for example in an image of 640X480 pixels, imagine how many thousands of points are needed to represent the boundary of a rugby ball). However, the thing that interests me is that all the points of the shape are taken into account, no exceptions, regardless of the shape that I intend to represent, which could be an ellipsoid, but also, more specifically, an ovoid or otherwise any other closed curve exhibiting a symmetry along the semi-major axis.

    However, from this discussion I can derive that, given a set of points representing a form (not known a priori), there isn't a general method that allows to obtain the equation that represents that shape, and the only "mathematically/geometrically correct" representation of this shape may be obtained only by interpolating all its points in a lagrangian form?

    According to you, I'm right?
    ebaines's Avatar
    ebaines Posts: 12,131, Reputation: 1307
    Expert
     
    #9

    Nov 29, 2012, 10:42 AM
    Quote Originally Posted by giusyvenezia View Post
    According to you, I'm right?
    Yes. The basic problem here is that given N points there are an infinite number of curves that can fit those N points, so without any additional information it's impossible to know which curve is "correct." Using the method we've been dicussing here gives one possible curve that fits the points, and given large enough N it may be "good enough." But keep in mind that the nth-order polynomial is a proper function - given x there is one value for y - whereas for an ellipse, circle, or any cliosed shape there may be two (and perhaps more) values of y for each value of x. So the polynomial fails if you enter two values for y for the same value of x; for example no polynomial can fit both (0,1) and (0,-1). Also be careful to not use both positive and negative values of 'y' as it can mess things up - attached is the 8th order polynomial but with some of the y values being negative, and it looks nothing like the ellipse the points were taken from!
    Attached Images
     
    giusyvenezia's Avatar
    giusyvenezia Posts: 6, Reputation: 1
    New Member
     
    #10

    Nov 29, 2012, 12:11 PM
    Thank you very much for all. If I have some other question I'll let you know.

    I'm sorry for your trouble and thank you again.
    ebaines's Avatar
    ebaines Posts: 12,131, Reputation: 1307
    Expert
     
    #11

    Nov 29, 2012, 12:20 PM
    No trouble at all! Good luck with your project.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Find the exact equation of the tangent line to f(x) = ln(x) at x = 9. [ 1 Answers ]

Use the equation of the tangent line to approximate values for ln (9.1) and ln (10). Use the graph of f(x) to determine whether the approximate values are smaller or larger than the true values.

What is an equation of the line that passes through the points (3,-3) and (-3,-3)? [ 1 Answers ]

I need your help... with that... I got algebra exam 2omorrow...

Find equation when given passing points [ 1 Answers ]

Find an equation of the form y=ax^2+bx+c whose graph passes through the points (-1,-4), (-3,-14) and (4,-14).

Deriving the equation for the rest-mass energy of a non relativistic object [ 0 Answers ]

Hello I am asked to derive this formula by applying a binomial expansion to the expression for 'gamma factor' (that funny y shaped symbol). To make things clear I will denote gamma as 'y' and beta as 'b' Now I know that yb = ((y-1)(y+1))^1/2 and have proved it by changing b into an expression...


View more questions Search