LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2D Non-Linear Curve Fitting

Solved!
Go to solution

thanks a lot, that is super appreciated! like I said before, don't rush, eat first when you get home... this isn't really an issue till Monday.. but I need to lube up and prepare for Monday... LOL

0 Kudos
Message 11 of 15
(2,412 Views)

For each point, x and y are known, so x, y , xy, x^2, etc. are just constants to be multiplied with your coefficients. This reduces to simple linear algebra once you calculate these terms for all valid points.

0 Kudos
Message 12 of 15
(2,410 Views)
Solution
Accepted by Jewsus

OK, here's a quick example based on my earlier work. It takes a 2D array, retains all non-NaN values and their indices, constructs the H matrix and does a fit to a second order 2D polynomial.

 

Note that the terms A..F are in slightly different order to your example, but I am sure you can deal with that ;))

 

(see also my page here)

 

2DpolyFit.png

Message 13 of 15
(2,389 Views)

You're a god among men. Ty so much! I'm going through it now to improve my understanding of how to tackle these things and apply them to future higher dimensional fits! Have a great day/week altenbach

0 Kudos
Message 14 of 15
(2,359 Views)

Should work with very few changes for any number of dimensions or polynomial orders (within reason!). Just stack more FOR loops and reshape to higher dimensions accordingly. 😄

 

You could probably write code that is scalable where everything adapts and only a change in the input and output dimensionality is needed. Maybe it could be made into a vim accepting DBL arrays of any number of dimensions. 😄

Message 15 of 15
(2,340 Views)