MATLAB Function Reference
  Go to function:
    Search    Help Desk 
interpn    See Also

Multidimensional data interpolation (table lookup)

Syntax

Description

VI = interpn(X1,X2,X3,...,V,Y1,Y2,Y3,...) interpolates to find VI, the values of the underlying multidimensional function V at the points in the arrays Y1, Y2, Y3, etc. For a multidimensional V, you should call interpn with 2*N+1 arguments, where N is the number of dimensions in V. Arrays X1,X2,X3,... specify the points at which the data V is given. Out of range values are returned as NaN.

Y1, Y2, Y3,... can be matrices, in which case interpn returns the values of VI corresponding to the points (Y1(i,j),Y2(i,j),Y3(i,j),...). Alternatively, you can pass in the vectors y1, y2, y3,... In this case, interpn interprets these vectors as if you issued the command ndgrid(y1,y2,y3,...).

VI = interpn(V,Y1,Y2,Y3,...) interpolates as above, assuming X1 = 1:size(V,1), X2 = 1:size(V,2), X3 = 1:size(V,3), and so on.

VI = interpn(V,ntimes) expands V by interleaving interpolates between each element, working recursively for ntimes iterations. interpn(V,1) is the same as interpn(V).

VI = interpn(...,method) specifies alternative methods:

Discussion

All the interpolation methods require that X,Y and Z be monotonic and have the same format ("plaid") as if they were produced by ndgrid. Variable spacing is handled by mapping the given values in X1,X2,X3,... and Y1,Y2,Y3,... to an equally spaced domain before interpolating. For faster interpolation when X1,X2,Y3, and so on are equally spaced and monotonic, use the methods '*linear', '*cubic', '*spline', or '*nearest'.

See Also

interp1     One-dimensional data interpolation (table lookup)

interp2     Two-dimensional data interpolation (table lookup)

ndgrid      Generate arrays for multidimensional functions and interpolation



[ Previous | Help Desk | Next ]