LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2D general polynomial fit

I’d like a 2D version of LabVIEW’s “General Polynomial Fit” VI, where its X and Y arrays are 2D. If I could find such an algorithm in a text-based language, I could probably write it in LabVIEW.

 

Here’s what I’m trying to do, in case there’s a better way: I have a thin rectangular semiconductor panel being manufactured, and about 6,000 tiny parts will be cut out of it. Ideally the panel would have uniform thickness so that all the tiny parts would have the same thickness, but thickness varies gradually across the panel. I currently have the panel’s thickness measured in only nine evenly spaced points around its perimeter and its center, with a pattern like this:

 

*      *      *

 

*      *      *

 

*      *      *

 

Knowing just those nine thickness numbers, I’d like to estimate the thickness of each device between and around those measured points.

0 Kudos
Message 1 of 16
(14,454 Views)
See if my old answer here can bring you any closer. 😄
0 Kudos
Message 2 of 16
(14,453 Views)

I traced those links to your 3DPolyFitFULL3D_12.vi which has two core subVIs PolyNonlinear Lev-Mar Fit.vi and General LS Linear Fit (obs).vi which I suspect can do the math I'm looking for, but I'm too ignorant of curve fitting math to get my data in (or out) of those VIs.

 

If you will dumb down to my level briefly, I'll state my question, and hopefully you could tell me where the data goes.... I have LabVIEW 8.2.1 installed and 8.5 disks somewhere.

 

Suppose that my 3 x 3 array of measured thicknesses I drew earlier coincidentally had both x- and y-values of 10, 50, and 90, and I measured the thicknesses as z-values that, for simplicity, were the integers 1 through 9. At this point, I'd have three arrays of nine values to somehow send to those VIs:

 

x[] = { 10, 50, 90, 10, 50, 90, 10, 50, 90};

y[] = { 10, 10, 10, 50, 50, 50, 90, 90, 90};

z[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9};

 

Drawn spatially on the panel, the (x, y, z) coordinates of the nine measured points would look like this, supposing x is horizontal, y is vertical, and z is measured thickness:

 

(10, 10, 1)   (50, 10, 2)   (90, 10, 3)

(10, 50, 4)   (50, 50, 5)   (90, 50, 6)

(10, 90, 7)   (50, 90, 😎   (90, 90, 9)

 

Now suppose I have 10,000 points whose x- and y-values are both coincidentally 1 through 100, so they overlay those 9 points above, and I'd like to estimate their z-values.

 

How would I fit such data into those VIs?

0 Kudos
Message 3 of 16
(14,432 Views)

OK, I always wanted to simplify one of my old examples, here's a quick draft (LV 8.2) starting with 9 points and generating a smooth polynomial surface of order 0..2. Since you only have 9 points, the highest order is 2.

 

See if this makes sense. 🙂 (there could be bugs).

 

Message Edited by altenbach on 08-30-2008 12:43 PM
Download All
Message 4 of 16
(14,431 Views)

That makes sense; I even see what the H array means, thanks.

 

In the simple two-dimensional example you made for me (that was fast), I noticed the "Best Fit Z" doesn't quite match the Z values of the input data, the way it would in an analagous one-dimensional scenario where a 2nd degree polynomial would exactly match any three points on an x-y plane. For my panel experiment, I'll have to assign my thousands of Z-guesses to the individual parts, but it would look odd when the nine parts being measured didn't have assigned z-values that matched their measured values.

 

Do you know of an algorithm that might get those measured values exactly right? It's clear I'm not the math expert, but I Googled a bit-- would "Bilinear Interpolation" or "Bicubic Interpolation" be the right approach?

0 Kudos
Message 5 of 16
(14,425 Views)

bmihura wrote:

 

In the simple two-dimensional example you made for me (that was fast), I noticed the "Best Fit Z" doesn't quite match the Z values of the input data, the way it would in an analagous one-dimensional scenario where a 2nd degree polynomial would exactly match any three points on an x-y plane. For my panel experiment, I'll have to assign my thousands of Z-guesses to the individual parts, but it would look odd when the nine parts being measured didn't have assigned z-values that matched their measured values.

Do you know of an algorithm that might get those measured values exactly right? It's clear I'm not the math expert, but I Googled a bit-- would "Bilinear Interpolation" or "Bicubic Interpolation" be the right approach?


For a 2D quadratic polynomial  (coefficients are ABCDEF)

 

Z =  A + Bx +Cy + Dx² + Exy + Fy²

 

You have only 6 parameters, so the data will match only if you use exactly 6 unique points.

 

You have 9 points and an overdetermined problem, thus you get a least square solution.

 

 

Here's a simplified version that uses integer grid points and outputs a 2D array.

Message 6 of 16
(14,417 Views)

Hello altenbach,

 

Can you help me with following:

 

I do measurement of voltage, temperature and magnetic field and try to find interpolation polynom as B=f(V,T).  I use General LS linear fit which I study from your example.

It is complicated for me now to change temperature and I would like to do interpolation only as B=f(V, T=const (let say=0)) so thal later I can add temperature parameter when I establich setup with temp.

 

I modified you example by mean that I put my measured values. It seems to work fine for B=f(V,T) but not for B=f(V, T=0). eg it works only for LS with order up to 2. for higher order the coefficient  assigned to T is different from  zero. I can not allow any value different from zero since practicaly temperature is changing up to 0.5deg but I want to have polynom independant from temperature.

 

 

Regards

S

0 Kudos
Message 7 of 16
(13,529 Views)

Hello Any

 

I work further on this subject and try to work with griddata function. Still results are not good and 2D surface interpolation does not works fine. The measured points are far away from interpolated.

 

see attached labview 2011

Sasa

0 Kudos
Message 8 of 16
(11,754 Views)

You data is concentrated along some nearly planar line in 3D, what exactly do you expect from the griddata result?

Your Z data varies by only %0.03% between all point, this might make some computations ill conditioned. As I first step, you might want to subtract the mean from all Z data.

 

Wouldn't it look better if you would fit it to a 2D polynominal as in the topic of this thread?

0 Kudos
Message 9 of 16
(11,744 Views)

I wrote this many years ago.  You might find it helpful.

0 Kudos
Message 10 of 16
(11,730 Views)