griddata vs griddedinterpolant vs scatteredInterpolant for given data
Ältere Kommentare anzeigen
I wish to perform 2D interpolation of a data. The data is such that
X Y V
1 1 7
2 3 9
3 5 8
4 6 4
implying that V(1,1)= 7, V(2,3) =9, V(3,5)= 8 and V(4,6) = 4. I wish to find the values of V(1,3), V(1,5), V(1,6), V(2,1), V(2,5) and so on (basically all V(i,j), i not equal to j).
Since interp2 requires meshgrid format, from my reading of documentation, i guess that interp2 might not be a suitable function to use. Is it correct?
What is difference between griddata, griddedinterpolant and scatteredInterpolant to use for interpolation of this data? Can i use all of them for interpolation of such data givn above, how do I determine which is the most suitable to use for the above data
At the link 2D interpolation of data - MATLAB Answers - MATLAB Central (mathworks.com), scatteredInterpolant is suggested for interpolation. What if i use griddata or griddedinterpolant. Can i use it, what will be the difference?
Akzeptierte Antwort
Weitere Antworten (2)
Bjorn Gustavsson
am 2 Nov. 2022
2 Stimmen
griddedinterpolant expects points on a regular grid pretty much like interp2 - so that function seems unsuitable for your case. As to the difference between griddata and scatteredInterpolant the main difference as I understand it is that the latter gives you a function that you can effectively call multiple times and re-use the triangulation that both methods use to interpolate, while repeated calls to griddata on the same data-set will redo that triangulation again and again. In addition to the common interpolation methods griddata also gives you the option to use the legacy 'v4' interpolation-method (which if my memmory serves me OK was some kriging base/like method).
One point of concern for you is that the X-Y points are close to co-linear and their triangulation doesn't span much - therefore triangulation-based interpolation will be restricted to a very narrow triangular region - outside of that extrapolation will be used. And we all know the perils of extrapolation.
HTH
Bruno Luong
am 2 Nov. 2022
Bearbeitet: Bruno Luong
am 2 Nov. 2022
1 Stimme
gridded data interpolant (A set of points that are axis-aligned and ordered, generated by meshgrid/ndgrid on monotonic grid vectors ) are just like what required by interp2, so it's out since your data doesn't meet that requirement.
They are just different implementation, some of them perform interpolation in 2 steps for better workflow if needed.
1 Kommentar
Bruno Luong
am 2 Nov. 2022
Bearbeitet: Bruno Luong
am 2 Nov. 2022
Recommendation for scattered data:
Use scatteredInterpolant is you need to interpolation of query points at various places for the same sample points
Use griddata if you use 'v4' method, which I find quite remarkable in some circumstance, and I regret it is not implemented in scatteredInterpolant. The 'v4' is initially developped for stalite data acquired on narow tracks on earth surface.
Kategorien
Mehr zu Interpolation finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!