CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   Polynomial fitting (

Simbelmynė August 9, 2012 10:52

Polynomial fitting

I am fitting polynomials of different degree to some data points.

p(x,y) = a + bx + cy

Question: If I fit the above polynomial to 3 points then I might get a singular matrix when I try to solve the system (e.g. if the points are located on the same axis). What is the rule here in order to Not get a singular matrix?

I wish to fit an arbitrary number of points to a polynomial of higher order and while the above case is simple to figure out I believe I lack the understanding to avoid singular matrices (some times it might work and other times it might not) when doing this.


sbaffini August 9, 2012 17:58

In 2D (x and y) and a polynomial whose maximum order is n the requirement is that no more than n+1 points are aligned. In 3D (x, y and z) you also have the requirement that no more than (n+1)*(n+2)/2 points can be on the same plane.

That's all i remember, but i guess there is some material around on the multi-dimensional polynomial interpolation.

As a side note, consider that for any valid point distribution you can always find a non valid one in the way of exchanging the position of just two points. Indeed, this operation has the effect of exchanging two rows in the interpolation matrix hence, as this imply a change in the sign of the determinant, somewhere along the path the determinant has become 0.

Simbelmynė August 10, 2012 03:33

Thank you, this was helpful!

By alignment, I assume that you also include diagonal alignment, right?

sbaffini August 10, 2012 05:35

Yes, alignment in any direction (2D of course).

FMDenaro August 10, 2012 11:41

if you use Lagrangian simplex (triangles in 2D, tethraedron in 3D), you will be sure that the matrix is never singula

All times are GMT -4. The time now is 02:20.