Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I try to make a table SimpleTable and to interpolate a function of two variables, I encounter a problem.

For example:

SimpleTable = Table[{j, i, 2 i - 3 j}, {j, 0, 5}, {i, -5, 5}];

and interpolation:

f := Interpolation[SimpleTable]

and if I try:

f[1, 2]

I get the error messages:

Interpolation::udeg: Interpolation on unstructured grids is currently only supported for InterpolationOrder->1 or InterpolationOrder->All. Order will be reduced to 1. >>

Interpolation::inder: The order-2 derivative of {0,-2,-4} is not a tensor of rank 2 with dimensions 3. >>*)

To me the table SimpleTable seems to have a "rectangular domain". What is wrong here? How to tackle this problem, to get an interpolated function from the table? Does the domain have to be changed?

Although the unstructured grids have already been mentioned here, I was hoping that somebody could make clear how to interpolate a function from 3-D data, without the unstructured grid warning.

share|improve this question
f = ListInterpolation[SimpleTable] ? – Sektor Mar 10 '14 at 12:44
user113891, welcome to! (a bit delayed, but still from the heart :P). Would you please consider setting a username? – Jacob Akkerboom Mar 10 '14 at 12:50
@JacobAkkerboom Thanks for the advice – david1983 Mar 10 '14 at 12:57
@Sektor. I tried with f = ListInterpolation[SimpleTable] , and after: f[1,2] didn't get the function value, but the error message: ListInterpolation::inhr: "Requested order is too high; order has been reduced to {3,3,2}." – david1983 Mar 10 '14 at 12:59
@david1983 Well, you are trying to pass 2 arguments to a function that accepts 3... That's not gonna work :) Try f[1,2,3] and see what happens SimpleTable//MatrixForm – Sektor Mar 10 '14 at 13:03

If you check the documentation for Interpolation the correct syntax for multidimensional data is

Interpolation[{{{x1, y1, ...}, f1}, {{x2, y2, ...}, f2}, ...}]

So you will need to modify your code to put the {x, y} coordinates in a list, and Flatten the table:

SimpleTable = Table[{{j, i}, 2 i - 3 j}, {j, 0, 5}, {i, -5, 5}] ~Flatten~ 1;
f = Interpolation[SimpleTable];
f[1, 2]
(* 1 *)

Alternatively you can omit the x,y coordinates entirely and use ListInterpolation:

data = Table[2 i - 3 j, {j, 0, 5}, {i, -5, 5}];    
fun = ListInterpolation[data, {{0, 5}, {-5, 5}}];    
fun[1, 2]

(* ==> 1 *)
share|improve this answer
+1, I learned something. I will be tougher on myself and try to answer new users questions with only elementary functions/constructions, in order to gain the right to complain about this infix notation, though :P. – Jacob Akkerboom Mar 10 '14 at 13:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.