Surface fitting with MATLAB polyfitn polyfitn at File Exchange Polynomial modeling in 1 or n dimensions gridfit gridfit at File Exchange Model 2-d surfaces from scattered data.