How to define endslopes for spline interpolation for 2-dimensional curves?
조회 수: 5 (최근 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
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
Now I was wondering, whether there is any simple way (formula) with which you can choose the endslopes rather than just "trying"
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!