getting slope information from griddedInterpolant
13 次查看(过去 30 天)
显示 更早的评论
Hey when evaluating a griddedInterpolant, the computer should at some pont determine the slope of the interpolant at the query point. is there a way to modify the griddedInterpolant such that he not only provides the value at the query point but also the slope (without any additional computations).
i.e. instead of interpolant(x)=approximation(f(x)) interpolant(x)=approximation([f(x) f'(x)])
If not, does anyone have a handmade interpolant code that runs similarilye efficient?
Thanks
Dominik
3 个评论
Matt J
2014-1-31
There are a variety of interpolation routines on the FEX, which you could try to modify. There are also routines dedicated to splines and their derivatives, e.g.,
回答(1 个)
Matt J
2014-1-30
编辑:Matt J
2014-1-31
griddedInterpolant is a built-in function and can't be modified.
Assuming you're talking about 1D interpolation, you can use this form of interp1 (see doc interp1)
pp = interp1(...'pp');
to get the piecewise polynomial representing the interpolated data, and then apparently this FEX file
to get derivatives, (though I haven't used it myself). Unfortunately, it appears that the above interp1 syntax is soon to be removed from MATLAB!
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!