Cubic Spline calculation after optimization

Hello dear MATLAB community,
at the moment I try to calculate a trajectory by solving a parametrised optimization problem. This works pretty good for many cases. But there are some cases where I get weird results.
The picture shows a weird calculated trajectory. The spline should go through the points but its shape is very weird. At the moment I´m calculating the trajectory with :
F1 = griddedInterpolant(f,x,'spline');
Way(1,:) = F1(x2);
F3 = griddedInterpolant(f,y,'spline');
Way(2,:) = F3(x2);
(also tried 'pchip' and 'cubic')
I have to use griddedInterpolant because I need to speed up the whole calculation and because I´m working with a parametrised function. All other functions (like cscvn or csape) take too long. My question is: Is there a possibility to set the first derivative of the first and the last point to 0 or to calculate the natural cubic spline and not a not-a-knot spline?
Thank you for your help!

답변 (0개)

카테고리

도움말 센터File Exchange에서 Splines에 대해 자세히 알아보기

질문:

2014년 10월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by