MATLAB: How Can I fill in holes in a grid/data set using bin averaging or LaGrange Interpolating Polynomials

.binaveragebin averagegrid populationImage Processing ToolboxinterpolatingSignal Processing Toolboxsparse

Hi Everyone,
I've been trying to figure out a way to bin average a 2D set of data to achieve a high enough grid resolution. For example, if I have an 8×8 chessboard with the value of every other cell known, I want to interpolate or average the existing data to populate the unknown cells. If less data is known (i.e. every 6th cell known), this process can just be repeated until the entire board is filled. Ideally it will be a 5 (or even 9) point method where the unknown cell in question obtains its value from an average of the surrounding 4 cell values (up, down, left, right).
Does anyone know of or have any suggestions of what type of command or process would be the best way to go about doing this? I eventually want to use something more accurate like LaGrange Interpolating polynomials but figured this would be the best way to start.
I will update my post with code when I get home, but any and all help is appreciated! Thank you!

Best Answer

Use a tool designed to fill in missing values exactly as you have. inpaint_nans is on the file exchange.
Just put NaNs in for the elements you need interpolated.