spline interpolation of angular data

13 views (last 30 days)
mukesh bisht on 25 Aug 2021
Answered: David Goodmanson on 25 Aug 2021
Hi, I tried to intepolate circular curve using spline interpolation using two different commands for same data sets. The examples are taken from matlab documentation :
Using function spline(x,y): https://in.mathworks.com/help/matlab/ref/spline.html
So, my query is as follows:
While using function spline(x,y), we define our phase angles or break points (here, x = pi*[0:.5:2];) and accordingly our piecewise polynomial (pp) has break points at breaks = pi*[0:.5:2].
While using function cscvn(points) we don't define our phase angles or break points. The break points of pp comes out to be breaks = [0, 1.1892, 2.3784, 3.5676, 4.7568];
So, in the 2nd function how is the break points coming so? If we see the values, the last value or angle is less than 360 even though the curve completes one round. How?
Secondly, If i plot my curve using these two functions along with points correspoding to breaks (shown as red dots). They are same but how? Clearly, the phase angles are different in both cases but how can they have same position on the plots.

David Goodmanson on 25 Aug 2021
Hi mukesh,
The regular cubic spline is using angle as the independent variable to define x and y parametrically in the usual way, x = cos(theta), y = sin(theta).
cscvn picks its own independent variable, which is not angle. Instead, the process is  as you proceed along the defined (x,y) points in order, find the euclidean distance between each pair.  take the square root of each distance  cumulatively sum those up to define the break points. The (x,y) points stay the same so they will still be on the resulting spine curve. In this case the distance between each pair of points is sqrt(2), so the break points are
[0 1 2 3 4]*sqrt(sqrt(2))
which is what you show above.