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:
http://poquitopicante.blogspot.com/2013/03/horners-method-in-2d.html
They are also hosted in a Gist on Github here:
https://gist.github.com/mikofski/5159267
Mark Mikofski (2019). polyVal2D and polyFit2D (https://www.mathworks.com/matlabcentral/fileexchange/41097-polyval2d-and-polyfit2d), MATLAB Central File Exchange. Retrieved .
1.1.0.0 | now with polyDer2D.m |
Inspired by: 2D Weighted Polynomial Fitting and Evaluation, polyfitn
Create scripts with code, output, and formatted text in a single executable document.
Benjamin (view profile)
Rayane Karim (view profile)
assert(all((n+1)*(m+1)<=Npoints)......
'Degree must be smaller than number of data poiints.')
work also fine when Degree must be smaller "or equal" than number of data
Zoe (view profile)
Much better than the personal one I wrote.