Cubic Spline calculation after optimization

1 次查看(过去 30 天)
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 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by