Message Boards Message Boards

GROUPS:

Interpolation, unstructured grids, and interpolation order

Posted 8 years ago
8732 Views
|
3 Replies
|
8 Total Likes
|
Hello
Interpolation throws an error (Interpolation::udeg: Interpolation on unstructured grids is currently only supported for InterpolationOrder->1 or InterpolationOrder->All. Order will be reduced to 1.) when called on an unstructured grid.   However, I get either nothing or an error when I try the suggested interpolation orders.  Am I doing something wrong, or is this a bug?

Example data for interpolationGrid is given at the end of the post.
Works:
interp = Interpolation[interpolationGrid] (*works just fine*)
interp[0.5, 1.5]

Throws error
rinterp = Interpolation[Reverse /@ interpolationGrid] (*throws the Interpolation::udeg:  error*)

Interpolation does not throw an error, but returns an InterpolatingFunction that looks right but throws an error when used
rinterp  = Interpolation[Reverse /@ interpolationGrid, InterpolationOrder -> All]
rinterp[-10, -50] (* throws Thread::tdlen: Objects of unequal length *)


Interpolation does not throw an error, but doesn't return a valid InterpolatingFunction:rinterp =
rinterp =Interpolation[Reverse /@ interpolationGrid, InterpolationOrder -> 1]


Example data:
interpolationGrid={{{0, 0}, {-46.469, -52.2776}}, {{0, 1}, {-42.9885, -37.615}}, {{0,
   2}, {-39.5618, -24.7261}}, {{0, 3}, {-35.8436, -13.4413}}, {{1,
   0}, {-41.014, -61.5209}}, {{1, 1}, {-38.638, -45.0776}}, {{1,
   2}, {-35.7402, -29.7835}}, {{1, 3}, {-32.0293, -16.0146}}, {{2,
   0}, {-31.049, -69.8602}}, {{2, 1}, {-29.9241, -52.3672}}, {{2,
   2}, {-28.4003, -35.5004}}, {{2, 3}, {-25.9637, -19.4728}}, {{3,
   0}, {-16.8131, -75.6591}}, {{3, 1}, {-16.5981, -58.0934}}, {{3,
   2}, {-16.3716, -40.929}}, {{3, 3}, {-15.9872, -23.9808}}}
3 Replies
When interpolating on an unstructured grid, the function values can only be real or complex numbers.
Furthermore, only machine precision is supported and any data will be coerced to machine precision.
Thanks!  This works just fine:
rinterp =
Interpolation[{First[#], First[Last[#]]} & /@
   Reverse /@ interpolationGrid, InterpolationOrder -> All]
Posted 2 months ago

If the unstructured grid is not too large ResourceFunction@"PolyharmonicSplineInterpolation" works great.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract