Given a n by m matrix representing m vectors in n dimensions. Calculate the arc length of the closed loop curve going though these points in the order that they are given. The parametric curve, c(t) , between points p(k) and p(k+1) is defined as,
c(t) = p(k-1) * (-t/2+t^2-t^3/2) + p(k) * (1-5/2*t^2+3/2*t^3) + p(k+1) * (t/2+2*t^2-3/2*t^3) + p(k+2) * (-t^2/2+t^3/2),
where t goes from 0 to 1. These interpolation polynomials can also be found using the constraints c(0)=p(k), c(1)=p(k+1), c'(0)=(p(k+1)-p(k-1))/2 and c'(1)=(p(k+2)-p(k))/2.
For example for the points
points = [[1; 0] [0; 1] [-1; 0] [0; -1]];
would yield to following curve:
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers5
Suggested Problems
-
Sort a list of complex numbers based on far they are from the origin.
5804 Solvers
-
Sum all integers from 1 to 2^n
17694 Solvers
-
Create a square matrix of multiples
500 Solvers
-
Create Volcano (or Atoll) martix. It is an extension of Bullseye matrix problem.
160 Solvers
-
138 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
How confident are you that your answers are correct to the tolerances you have specified?
Have not tried the problem yet but tolerances seem below eps(dist_correct) in several cases, could you perhaps just relax these a bit?
I relaxed the tolerances in the test suite.