Clear Filters
Clear Filters

Cubic Spline calculation after optimization

2 views (last 30 days)
David
David on 21 Oct 2014
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!

Answers (0)

Community Treasure Hunt

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

Start Hunting!