Skip to content
All library documents

Bilinear Interpolation for Looking Up Values on a 2D Surface

Article Quant Q&A · Author: Zac

Summary

The document explains how to retrieve a value from a precomputed two-dimensional surface when the requested coordinates fall between grid points. It uses bilinear interpolation: first, linearly interpolate along the x direction at each of the two surrounding y grid levels; then interpolate those two intermediate values along y. The resulting value estimates the surface at the requested x and y coordinates.

This method is presented as a straightforward lookup for a discretely sampled surface, rather than an optimization problem. The example gives the interpolation equations but does not discuss how to choose the grid, handle points outside its bounds, or quantify approximation error. Those choices depend on the surface and the application, so the brief explanation does not establish that linear interpolation is suitable for every calibrated surface.

Key ideas

  • Bilinear interpolation estimates a surface value from the four grid points surrounding a query location.
  • Interpolate along one coordinate at each neighboring level of the other coordinate, then interpolate between those results.
  • The method provides a direct lookup between mesh points without solving a separate optimization problem.
  • Grid boundaries and interpolation error require separate treatment, which the document does not address.

Tags

Full text
# How do people 'lookup' values from calculated surfaces?


# How do people 'lookup' values from calculated surfaces?












I have been wondering how the following situation is / should be implemented.

Consider some kind of surface $z = f(x,y)$ which has to be pre-calculated; the shape of this surface would not have a closed-form solution, but would instead be calibrated by some time-consuming numerical methods, which are updated asynchronously (e.g. some overnight calibration job).

Given this surface (which presumably is defined over some discrete meshgrid), how do we perform a 'look-up', such that we can recover $z$ for any $x$ and $y$?

I can't tell if this is a complex interpolation or optimisation problem, or if there are really trivial ways that this is achieved in practice?

## Answer by Kurt G. (score 2, accepted)

https://quant.stackexchange.com/a/70150

A linear interpolation in 2d is not much more complicated that in 1d: \begin{align} \color{red}{f(x,y_i)}&=\frac{f(x_i,y_i)(x_{i+1}-x)+f(x_{i+1},y_i)(x-x_i)}{x_{i+1}-x_i}\,,\\[3mm] \color{red}{f(x,y_{i+1})}&=\frac{f(x_i,y_{i+1})(x_{i+1}-x)+f(x_{i+1},y_{i+1})(x-x_i)}{x_{i+1}-x_i}\,,\\[3mm] f(x,y)&=\frac{\color{red}{f(x,y_i)}(y_{i+1}-y)+\color{red}{f(x,y_{i+1})}(y-y_i)}{y_{i+1}-y_i}\,. \end{align}

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.