This example shows how to construct and plot several different interpolating cublic spline curves using the cscvn function.
This code generates a sequence of points and then plots the cubic spline generated from the cscvn function. The chosen points are marked as circles:
points=[0 1 1 0 -1 -1 0 0; 0 0 1 2 1 0 -1 -2];
fnplt(cscvn(points)); hold on,
plot(points(1,:),points(2,:),'o'), hold off

This code plots a circular curve through the four vertices of the standard diamond (because of the periodic boundary conditions enforced):
fnplt(cscvn( [1 0 -1 0 1;0 1 0 -1 0] ))

This code shows a corner at the double point as well as at the curve endpoint:
fnplt(cscvn( [1 0 -1 -1 0 1;0 1 0 0 -1 0] ))

Finally, this code generates a closed curve with one double point, which results in a corner. Dedicate this to your loved ones.
c=fnplt(cscvn([0 .82 .92 0 0 -.92 -.82 0; .66 .9 0 ...
-.83 -.83 0 .9 .66])); fill(c(1,:),c(2,:),'r'), axis equal

免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删