File Exchange

image thumbnail

polyVal2D and polyFit2D

version (11.5 KB) by Mark Mikofski
Evaluate 2D polynomials using Horner's method. Fit 2D polynomials to data using backslash operator.


Updated 18 Apr 2013

View Version History

View License

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:

Cite As

Mark Mikofski (2021). polyVal2D and polyFit2D (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)

Johan Escalona


Briljant! Thank you so much! :)


Rayane Karim

'Degree must be smaller than number of data poiints.')

work also fine when Degree must be smaller "or equal" than number of data


Much better than the personal one I wrote.

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!