-2

I want to plot some points based on an image of a hand. Then, I should use lagrange interpolation method to plot all the points together so that the shape of a hand would appear. I faced a difficulty in making the interpolation as function is only valid for one to one or many to one. However, the shape of a hand would need 2 points that might have the same x-coordinate but different y-coordinate. Any suggestions?

Tom Jones
  • 19
  • 5

1 Answers1

2

You have a sequence of n points (x,y) which describes the shape of the hand. In matlab you could represent this by 2 vectors.

X=[x1;x2;..;xn]
Y=[y1;y2;..;yn]

Now you can describe the shape of the hand by a parametric equation.

x = f(t);
y = g(t);

To use lagrangian interpolation you have to choose a vector t of length n

t=[t1;t2;t3;...;tn] #(with t increasing)

For each element ti in t the following statement should be true.

xi = f(ti)
yi= g(ti)

This means that the curve described by f(t) and g(t) goes through all points you provided. You could find an equation for f(t) by using lagrangian interpolation on the vector x and g(t) by doing the same with y.

Now you just have to evaluate [f(t),g(t)] in a lot of values for t.

conclusion

To state the solution shortly. Represent the shape of the hand in parametric form. By doing this you could just do lagrangian interpolation seperately on the vector of x-coördinates and y-coördinates. (Make sure you use the same parameter and that that parameter is equal in any given point.)

Erik
  • 755
  • 1
  • 5
  • 17