How to define endslopes for spline interpolation for 2-dimensional curves?

1 次查看(过去 30 天)
While working with splines and trying to define some endslopes, I had some problems:
The example from matlab help worked fine:
x = pi*[0:.5:2];
y = [0 1 0 -1 0 1 0;
1 0 1 0 -1 0 1];
pp = spline(x,y);
yy = ppval(pp, linspace(0,2*pi,101));
plot(yy(1,:),yy(2,:),'-b',y(1,2:5),y(2,2:5),'or')
axis equal
But after that I wanted to try something like an ellipse:
x = pi*[0:.5:2];
y = [0 1 0 -1 0 1 0;
1 0 .1 0 -.1 0 1];
pp = spline(x,y);
yy = ppval(pp, linspace(0,2*pi,101));
plot(yy(1,:),yy(2,:),'-b',y(1,2:5),y(2,2:5),'or')
axis equal
elipse1.svg
I figured out that I had to change the endslopes to 0.15 to obtain the expected ellipse:
x = pi*[0:.5:2];
y = [0 1 0 -1 0 1 0;
.15 0 .1 0 -.1 0 .15];
pp = spline(x,y);
yy = ppval(pp, linspace(0,2*pi,101));
plot(yy(1,:),yy(2,:),'-b',y(1,2:5),y(2,2:5),'or')
axis equal
elipse2.svg
Now I was wondering, whether there is any simple way (formula) with which you can choose the endslopes rather than just "trying"

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Splines 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by