# availble solutions for 2D interpolation on non monotonic scattered data

11 vues (au cours des 30 derniers jours)
Laura le 8 Nov 2012
Hello,
I have been reading many posts regarding the interpolation of data of the form Z(x,y), being x y scattered data points which can not be transformed to monotonic vectors. However I still have some questions. My data are vectors of X, Y (coordinates), and associated Z, R.... of property values. Moreover the domain defined by X, Y vectors is not square. In this situation:
1. when I triangulate the data the triangles in the borders (actually in one border in my particular case) are sliver-like and connect points that are remote from each other. But also when creating an equi-spaciated grid in which to interpolate, I get quite a lot of NaNs for those triangles out of my triangulated region.
For getting rid of those problems I could: define a triangle shape factor criteria to eliminate "bad triangles", still have to figure out how. (the NaNs values I do not see it a real problem so far, one I know their reason)
2. Regarding the interpolation methods available I would like to know is there are more than the three available in TriScatteredInterp (linear, nearest and natural), or the 'cubic' available in griddata. I am referring mainly to the use of splines.
I would really appreciate any information on how I could optimize the use of those tools for my particular case, of if there is any other option that I am missing
Thanks
Laura
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponse acceptée

Dr. Seis le 8 Nov 2012
Modifié(e) : Dr. Seis le 8 Nov 2012
I posted this a while back, perhaps it could be useful here:
It should be parameterized similar to interp2 (except you won't be giving it input data on a regular grid)... but, like any interpolation algorithm, it might behave oddly in the same areas you are getting NaNs (since it is not good at extrapolation).
##### 2 commentairesAfficher AucuneMasquer Aucune
Laura le 9 Nov 2012
Thanks a lot. I tried and compared with the result from the gridfit routine uploaded to filexchange by John D'Errico (which I found after this question), and the result is pretty good! Only in the corners I get differences on the fittings.... which is normal.
I do only have a problem and is that for the grid of the input data I have different levels of refinement not equally distributed. When I perform the interpolation using the coarsest and fine grids combined the result is still good, but when I try to use the last level of refinement the interpolation crash due to singularities. In this last level the data in one region is in the order of 8 times more fine than in the external part. This might be creating a problem for the biharmonic spline interp2. I also tried with different levels of grid for the interpolation. Thanks a lot for the reply
Dr. Seis le 9 Nov 2012
Yeah... it looks like John's gridfit does a much better job at handling extrapolation (among other things) than the 2D biharmonic spline. Not sure why the BH spline is able to produce coefficients when input is both coarse and fine grids, but not when it is one or the other. I would be interested to see a picture of the X/Y locations of the fine grid compared to the coarse grid. What is the avg. spacing of the fine grid?

Connectez-vous pour commenter.

### Plus de réponses (1)

Laura le 9 Nov 2012
Hi. Sorry I might have not been really clear with the explanation of when the BH spline finds problems of singularities. My scattered data could be divided in three kind of "grid refinement". This meaning that I have data at distance of about 8mm in one direction in what I call coarse, data separated about 2 mm in a region inside that covered from the coarse "grid"(which I call fine), and within both of them another region in which the data is at about 1 mm (labeled ultrafine). When I use the BH spline on each of those levels independently, it works fine. If I use it in the combined set of data linking "coarse"and "fine" it works, when I include also the "ultrafine"to the last set or when I combine "fine" and "ultrafine" it gives problems of singularities (or bad escalation). I check the last with different levels of the grid Xi Yi for the interpolation but I found the same result. I can send you a picture of what I refer with coarse/fine/ultrafine data to your mail if I have neither been able to be clear with this explanation.
##### 2 commentairesAfficher AucuneMasquer Aucune
Laura le 9 Nov 2012
Of course a possible reason (sorry I didn't realize to say it before) is that I do have repeated data. Mainly when combining the "ultrafine"data and the "fine" data, which might explain the problems
Dr. Seis le 9 Nov 2012
Ah yes... repeated data will do that. The BH spline will put the surface it creates exactly through the data you input... so if you have overlapping data in X/Y and they are associated with different Z values, then it will blow up. In that case John's gridfit will definitely be the choice to use. If you still want to use BH spline (for comparison) you would need to eliminate repeated data (maybe by throwing away data or some sort of average between the two or ... ?).

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by