griddedInterpolant — Create an object that interpolates real dense data on a rectilinear grid.

griddedInterpolant constructs an interpolant object with GridVectors, Values, Method, and ExtrapolationMethod properties. Calling the object with parentheses evaluates the interpolant at query points.

Syntax

F = griddedInterpolant
F = griddedInterpolant(V)
F = griddedInterpolant(x, v)
F = griddedInterpolant(gridVecs, V)
F = griddedInterpolant(X1, X2, ..., Xn, V)
F = griddedInterpolant(___, Method)
F = griddedInterpolant(___, Method, ExtrapolationMethod)

Inputs

NameTypeRequiredDefaultDescription
argsAnyVariadicGrid vectors or full grids, values, interpolation method, and extrapolation method.

Returns

NameTypeDescription
FAnyGridded interpolant object.

Errors

IdentifierWhenMessage
RunMat:griddedInterpolant:InvalidInputGrid, value, method, or query inputs are invalid.griddedInterpolant: invalid input
RunMat:griddedInterpolant:UnsupportedMethodThe requested interpolation or extrapolation method is not implemented by RunMat.griddedInterpolant: unsupported interpolation method
RunMat:griddedInterpolant:InternalObject construction, property access, or interpolation output construction fails.griddedInterpolant: internal error

How griddedInterpolant works

  • griddedInterpolant(V) uses default grid vectors 1:size(V,dim).
  • griddedInterpolant(x, v) and griddedInterpolant({x1,...,xn}, V) use explicit compact grid vectors.
  • Full-grid construction with griddedInterpolant(X1,...,Xn,V) extracts compact grid vectors from monotone full grids.
  • Evaluation supports F(xq) for 1-D data, F(xq1,...,xqn) for matching-shape query arrays, F(Xq) for row-wise N-D query points, and F({xg1,...,xgn}) for full query grids.
  • Linear, nearest, next, and previous methods are supported. PCHIP and spline methods are supported for 1-D grids. Cubic, makima, and N-D higher-order interpolation are reported as unsupported instead of approximated.

Examples

Linear interpolation from explicit sample points

F = griddedInterpolant([0 1 2], [0 10 40]);
yq = F([0.5 1.5])

Expected output:

yq = [5 25]

Two-dimensional interpolation from grid vectors

F = griddedInterpolant({[0 1], [0 2]}, [0 20; 10 30]);
yq = F(0.5, 1)

Expected output:

yq = 15

Using griddedInterpolant with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how griddedInterpolant changes the result.

Run a small griddedInterpolant example, explain the result, then change one input and compare the output.

Interpolation

interp1 · interp1q · interp2 · pchip · ppval · spline

Elementwise

abs · angle · bsxfun · complex · conj · double · erf · erfcinv · exp · expm1 · factorial · flintmax · gamma · gammaln · heaviside · hypot · idivide · imag · intmax · intmin · ldivide · log · log10 · log1p · log2 · minus · nextpow2 · plus · pow2 · power · rdivide · real · realmax · realmin · realsqrt · rescale · sign · single · sqrt · swapbytes · times · uint32

Trigonometry

acos · acosh · asin · asinh · atan · atan2 · atanh · cos · cosd · cosh · cospi · deg2rad · pol2cart · rad2deg · sin · sind · sinh · sinpi · tan · tand · tanh

Reduction

all · any · bounds · cummax · cummin · cumprod · cumsum · cumtrapz · diff · gradient · max · maxk · mean · median · min · mink · movmax · movmean · movmedian · movmin · movprod · movstd · movsum · movvar · nnz · prod · rms · std · sum · trapz · var

Rounding

ceil · fix · floor · mod · rem · round

Factor

chol · decomposition · eig · eigs · lu · qr · svd

Solve

cond · det · inv · linsolve · norm · null · pinv · rank · rcond · rref · vecnorm

Symbolic

digits · int · limit · piecewise · sym · syms · vpa

Fft

fft · fft2 · fftshift · ifft · ifft2 · ifftshift

Discrete

lcm · primes

Ode

ode15s · ode23 · ode45

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how griddedInterpolant is executed, line by line, in Rust.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.