Re: 2d and 3d data interpolation



John D'Errico wrote:


PB wrote:


Lee Barker wrote:


I have a 2d data set that has evenly spaced data but the
table
is
incomplete, that is some values in the data set are not
given.
I
simply want to use an 2d interpolation function to 'fill'
in
the
unknown values (holes) based on a reasonable fit technique.

I have tried filling the unknown values with NaN and using
'interp2'
but it does not seem to provide values to fill in the
NaN's.
(I
had
partial success with getting interp1 to do this in a
simplified
experiment, but no success with interp2.)

I do not need to make the grid finer, just fill in the
'holes'
with
numbers that reasonably fit a surface across the hole. The
hole
may
be one grid point or many contiguous grid points. The holes
may
reside in the interior of the surface, or at the edges
where
values
wuld have to be effectively extrapolated.

I then want to extend this process to 3d.

Any suggestions as to alternative functions to try? I have
tried
interp2 and griddata.

Fill the unknowns with NaNs. Download and use inpaint_nans to
interpolate the NaNs. You´ll find inpaint_nans here:

<http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=4551&objectType=file>

/PB

Thanks for the plug PB.

Inpaint_nans will do it very nicely.

The only thing I'll comment about is that last
thing you asked about:

I then want to extend this process to 3d.

What size is your array? How many unknowns do
you expect to see? Really, this is the crucial
aspect. Are you looking to solve for a few
hundred elements, or even 10000-30000 unknowns?
Or are there far more?

I ask because while I could easily cobble together
a version that works in 3d, the basic algorithm
will possibly start to have memory problems for
somewhere around 30000 to 50000 unknowns (NaN
elements to solve for.) This very much depends
upon the density of the holes to inpaint over.
One single huge hole in 3-d on a 200x200x200
array may be impossible to solve for. Things get
big really fast in 3-d.

So if you find inpaint_nans useful, let me know
and I'll see if I can help out.

HTH,
John D'Errico

Thank you John. I have downloaded and tried your routine. Very user
friendly, thank you. I need to think about how to 'prepare' my data
better before I do anything more with your script (I have realized it
is not satisfactory for me to let an extrapolator fill in the edges.
I have better ways to bound the edge regions so I want to take care
of that first then run inpaint_nans to fill in just the interior.

Since you asked, my data sets are about 200x300x400 but if I thought
I could get away with it I would combine several sets and the result
would be 200x300x4000. Consider the first two dimensions to be grid
locations and the last to be time. Each set of grid point data for a
given time generally has between 75 and 95 percent of the data
populated, but there might be a grid set with no data at all.

Lee
.



Relevant Pages

  • Re: Float solution determination with unknowns
    ... unknowns x,y,z + ambiguities z0,z1,z2,z3,z4 ... you have 4 "redefined" phase variables and 4 phase ... John Morris ...
    (sci.geo.satellite-nav)
  • Re: Recent bike trip
    ... John knows more about boats than you ever will. ... Like, as they say, his lying about Obama being the only pres in recent times not to visit the Tomb of the Unknowns on Mem. ...
    (rec.boats)
  • Re: 2d and 3d data interpolation
    ... I have a 2d data set that has evenly spaced data but the table ... I have tried filling the unknown values with NaN and using ... I do not need to make the grid finer, just fill in the 'holes' ... Fill the unknowns with NaNs. ...
    (comp.soft-sys.matlab)
  • Re: Recent bike trip
    ... John knows more about boats than you ever will. ... Like, as they say, his lying about Obama being the only pres in recent times not to visit the Tomb of the Unknowns on Mem. ...
    (rec.boats)
  • Re: Recent bike trip
    ... John knows more about boats than you ever will. ... Like, as they say, his lying about Obama being the only pres in recent times not to visit the Tomb of the Unknowns on Mem. ...
    (rec.boats)