What is the best way of fitting polynomial regression to 3 dimensional data?

조회 수: 11 (최근 30일)
Muhammad alaied
Muhammad alaied 2019년 9월 22일
편집: Muhammad alaied 2019년 9월 23일
Hello, I have elevation measurements consist of X , Y coordinates and elevation value for each point.I want to fit polynomial regression, splines and so on ... I am trying fitnlm with modelfun but so far I did not succeed in doing so ..I am new on Matlab and machine learning so if there is any suggestions of how to do the fitting,it would be great.Thank you ..
  댓글 수: 4
dpb
dpb 2019년 9월 22일
You only have two independent variables, not three.
From doc link to modelnames from fit page one finds:
"For polynomial surfaces, model names are 'polyij', where i is the degree in x and j is the degree in y. The maximum for both i and j is five. The degree of the polynomial is the maximum of i and j. The degree of x in each term will be less than or equal to i, and the degree of y in each term will be less than or equal to j. See the following table for some example model names and equations, of many potential examples.
Examples of Polynomial Model Names for SurfacesEquations
poly21Z = p00 + p10*x + p01*y + p20*x^2 + p11*x*y
...
So, following their lead,
f=fit([X(:),Y(:)],Z(:),'poly22');
would fit your data with all terms of a quadratic in X,Y estimated.
I'd forgotten it, but you also have the option to choose either an interpolating or smoothing cubic spline...altho I don't recall for certain if the spline models inside it are more than one variable as opposed to surfaces.
Muhammad alaied
Muhammad alaied 2019년 9월 23일
편집: Muhammad alaied 2019년 9월 23일
Yes this works ..Thank you..I am tryıng to accept your answer but I do not see the button . It seems like you wrote the answer as a comment.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by