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

조회 수: 5 (최근 30일)
David
David 2019년 3월 4일
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에서 Spline Postprocessing에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by