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

11 views (last 30 days)
Laura on 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 CommentsShowHide -1 older comments

Sign in to comment.

### Accepted Answer

Dr. Seis on 8 Nov 2012
Edited: Dr. Seis on 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 CommentsShowHide 1 older comment
Dr. Seis on 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?

Sign in to comment.

### More Answers (1)

Laura on 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 CommentsShowHide 1 older comment
Dr. Seis on 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 ... ?).

Sign in to comment.

### Community Treasure Hunt

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

Start Hunting!