spline interpolation of angular data

13 views (last 30 days)
mukesh bisht
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.

Answers (1)

David Goodmanson
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 [1] as you proceed along the defined (x,y) points in order, find the euclidean distance between each pair. [2] take the square root of each distance [3] 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.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!