# Fitting points z = f(x,y) to a quadratic surface

• I
• maistral
In summary: If your data are concentrated at a certain point, then you could perhaps chose the tangent plane of your surface. But this depends on what is "close to a point".
maistral
Hi! I am aware that standard fitting numerical methods like Levenberg-Marquardt, Gauss-Newton, among others, are able to fit a dataset z = f(x,y) to a quadratic surface of the form z = Ax2 + Bxy + Cy2 + Dx + Ey + F, where A to F are the coefficients.

Is there a simpler method that exists? I'm trying to find something similar to fitting the same z = f(x,y) dataset to a linear plane z = A + Bx + Cy where it only involves solving matrices.

fresh_42 said:
Reads as a case of linear regression: https://en.wikipedia.org/wiki/Linear_regression

Actually I am looking for the method where I can fit the second-degree surface polynomial z= f(x,y) to datasets similar to the Vandermonde matrix method for fitting a simple y = f(x) polynomial.

The reference stated the Gauss-Newton algorithm, which I am trying to evade using. Is there such a method that can fit quadratic surfaces without the need for iterative algorithms?

You want to fit something curved into something linear, so you first have to find a measure for what is a good fit for you and what is not. The least squared distances come to mind, but which measure you chose, you will have to perform an optimization, and algorithms for this are of course iterative. An algorithm is by nature. What you are looking for is a one step formula. Let us assume for a moment that we have such a formula. How can we determine, whether our approximation is a good one or not? And if not, how can we proceed to a better one? Et voilà: the recursive algorithm is born.

If your data are concentrated at a certain point, then you could perhaps chose the tangent plane of your surface. But this depends on what is "close to a point".

Polynomial regression z = Ax^2 + Bxy + Cy^2 + Dx + Ey + F, in order to evaluate the coefficients A to F is a LINEAR regression because z is linear with respect to the unknowns A to F . Of course the function $z(x)$ is non-linear, but we are not looking for z or for x since they are given data.
This is a LINEAR REGRESSION for a non-linear function, which is very common and doesn't require iterative calculus.

About the fitting of quadratic surface to data without iterative methods : They are a lot of littérature on the subject. For example, see

WWGD and Stephen Tashi
maistral said:
Hi! I am aware that standard fitting numerical methods like Levenberg-Marquardt, Gauss-Newton, among others, are able to fit a dataset z = f(x,y) to a quadratic surface of the form z = Ax2 + Bxy + Cy2 + Dx + Ey + F, where A to F are the coefficients.

To speak of "fitting" a function to a data set does not describe a specific mathematical process. Statistically, a person who speaks of "fitting" z = f(x,y) = Ax^2 + Bxy + Cy^2 + Dx + Ey + F to a dataset is most often seeking the function ##f## that minimizes
##g(A,B,C,...) = \sum_{i=1}^n (z_i - (Ax_i^2 + Bx_iy_i + Cy_i^2 + Dx_i + Ey_i + F)\ )^2##

Is that the type of fitting you wish to do?

As @JJacquelin said, finding the extrema of ##g## can be done by a solving a system of linear equations. For example ##\frac{\partial g}{\partial B} = 0## is a linear equation in variables ##A,B,C,D,E,F##. The linear equations can be solved by matrix methods.

If you have experimental data ## (x_i,y_i,z_i) ## that has measurement errors in ##z_i## as well as in ##x_i,y_i##, you might be speaking of "Total least squares" fitting. I don't know much about that topic. ( The current Wikipedia article https://en.wikipedia.org/wiki/Total_least_squares looks specific and comprehensive, but I haven't tried to figure it out.)

WWGD
maistral said:
Actually I am looking for the method where I can fit the second-degree surface polynomial z= f(x,y) to datasets similar to the Vandermonde matrix method for fitting a simple y = f(x) polynomial.
As stated previously, you are looking for a linear regression, specifically the kind known as a polynomial regression. See here: https://en.wikipedia.org/wiki/Polynomial_regression (I wrote part of that article) -- it's a matrix solution for least-squares fit of any data set of n values to a polynomial of any order less than n. The lowest order polynomial (fitting to a straight line) is the simplest case of this solution.

## 1. What is the purpose of fitting points to a quadratic surface?

Fitting points to a quadratic surface is a way to model and analyze data in a 3-dimensional space. It allows for a better understanding of the relationships between variables and can help with making predictions or identifying patterns.

## 2. How do you determine the equation of the quadratic surface?

The equation of a quadratic surface can be determined by using a regression method, such as the method of least squares. This involves finding the coefficients that minimize the sum of the squared distances between the points and the surface.

## 3. What are the assumptions made when fitting points to a quadratic surface?

The main assumption is that the relationship between the variables can be represented by a quadratic function. Other assumptions include that the data is normally distributed and that there is no significant multicollinearity between the variables.

## 4. How do you evaluate the fit of the points to the quadratic surface?

The fit of the points to the quadratic surface can be evaluated by calculating the coefficient of determination (R-squared) and the root mean squared error (RMSE). A higher R-squared value and a lower RMSE indicate a better fit.

## 5. Are there any limitations to fitting points to a quadratic surface?

Yes, there are limitations to this method. It assumes a linear relationship between the variables and may not accurately represent complex relationships. It also may not be appropriate for data with outliers or extreme values. Additionally, the results may be affected by the choice of regression method and the number of data points.

Replies
8
Views
1K
Replies
1
Views
4K
Replies
2
Views
2K
Replies
2
Views
924
Replies
17
Views
2K
Replies
5
Views
1K
Replies
7
Views
2K
Replies
1
Views
2K
Replies
5
Views
11K
Replies
14
Views
3K