Often it's necessary to fit or evaluate a function with 2 dimensions. Use polyFit2D.m to fit a 2D polynomila to data and polyVal2D.m to evaluate it. Fun!
These functions are explained in detail here:
They are also hosted in a Gist on Github here:
Mark Mikofski (2019). polyVal2D and polyFit2D (https://www.mathworks.com/matlabcentral/fileexchange/41097-polyval2d-and-polyfit2d), MATLAB Central File Exchange. Retrieved .
now with polyDer2D.m