PP form for griddedInterpolant
Afficher commentaires plus anciens
Hello friends!
This morning I was going to use interp1 but noticed that matlab is going to remove it soon. Instead, they
recommend to use griddedInterpolant. No problem. But, then I realized that I cannot use many of the benifits
of interp1 easily. Especially and sadly, griddedInterpolant does not aprarently create a 'pp form' which is quite annoying
and non-aceptable (without pp form, I am not able to easily use 'fnder' and get the derivative). So, I am wondering wether
I should use interp1 (which will not work soon and I do not have time to correct my loads of codes in the future) or use
griddedInterpolant and accept the inconvenience of working with it (and hope that in the future they improve it). So, it seems to me
that matlab developers irresponsibly change the existing functions without transfering all the capabilities to the new commands
they like.
My question is not limitted to the case of 1D interpolation (oitherwise, I would not bother you). My question is "how to
find pp form with regards to griddedInterpolant command, and therefore being able to conveniently do whatever we cxould
do with interp1, interp2, etc"
Thanks in advance!
Babak
5 commentaires
KSSV
le 21 Jan 2022
Who says interp1 will be removed? I don't think so.
Mohammad Shojaei Arani
le 21 Jan 2022
Star Strider
le 21 Jan 2022
There is no evidence that interp1 is being deprecated. The method section describes the available interpolation methods. Some methods available previously have been deprecated and replaced by more computationally efficient, and otherwise equivalent, methods. Perhaps that generated the message.
The griddedInterpolant function has several interpolation options. There is no direct link, however go to Input Arguments and expand the Method section to explore them. An example on specifying them is given in the 2-D Interpolation Over Finer Grid section.
The ‘Note’ that showed up simply indicated that there is something wrong with your call to interp1, not that there is anything wrong with the function itself.
Steven Lord
le 21 Jan 2022
That Note appears only in one part of the Description section on the interp1 documentation page, the part for the syntax: "pp = interp1(x,v,method,'pp') returns the piecewise polynomial form of v(x) using the method algorithm." If it were a message about discouraging use of the interp1 function as a whole it would appear more like the hist function where the message discouraging its use comes at the top of the documentation page referring to all the syntax options for that function.
You can submit an enhancement request via Technical Support asking for a way to evaluate the derivative of a griddedInterpolant in those cases where it makes sense (what would the derivative be if the interpolation method was 'nearest', for example?)
Mohammad Shojaei Arani
le 22 Jan 2022
Réponses (1)
Damon Landau
le 2 Mai 2022
0 votes
The built-in csapi (or csape if you want to specify end conditions) outputs PP form of multi-dimensional splines. You can then use fnder to get derivatives and fnval to interpolate. This method also allows complex inputs for complex step as an alternative method to take partials.
Catégories
En savoir plus sur Spline Postprocessing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!