LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

General LS Linear Fit - Number of Equations

Hi Folks,

I'm using the "General LS Liner Fit" VI to interpolate Measurement Data depending on 2 Variables. To do this i would like to use an poly-equation of the form:

z = A + Bx + Cy + Dxy + Exyy ... Kxxxyyy ... etc.

This sems to work fine, but im not able to generate more than ~ 100 Parameters. If i try to do so the VI doesen't give me any results.

I have ~ 2000 Data Points so i create a H-matrix of 2000 x 100 Values as Input for the VI. Can this be too much? For an Matrix of 2000 x 81 Values the System still works an takes ~2 Seconds to evaluate a result.

If anyone knows this problem, knows a better solution or can tell me what im doing wrong please help me.

Greetings
Hans
0 Kudos
Message 1 of 5
(3,353 Views)
Hi Hans,

Could the condition number of the matrix be too high? What is the error value returned from the VI? You might try selecting a different algorithm ("algorithm" enumerated type input to VI). Perhaps another algorithm might be more stable for your problem. If the condition number of the matrix is too high you might consider a data reduction technique on the Y input. Can you take a subset of the fit points (Y), or perhaps interpolate at some subset of points to reduce the problem size (and hopefully the condition number)?
0 Kudos
Message 2 of 5
(3,353 Views)
I'm having the same problem. Seems that if you have more than 90 parameters, the General LS Linear Fit.vi returns error -20021. Seems like there is an unstated maximum array size for the GenLSFit_head function in the DLL the vi calls.

Did you ever find a workaround?
0 Kudos
Message 3 of 5
(3,353 Views)
This maximum number also depends on the fit algorithm you use (in the case of the general fit), or at least that's how I remember it from LV 5.0.

Shane
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 4 of 5
(3,353 Views)
What I am seeing is that all of the algorithms (SVD, Givens, Givens2, etc.) work up to 90 coefficients (although SVD sometimes reports error -20003 in my application), but fail starting at 91 coefficients. I need something more like 600+ coefficients.

Has anyone run across an alternative LS Fit VI? I found a customer-sumitted alternative called "General_LS_Linear_Fit+.vi", but it still uses the same NI DLL function.

I wouldn't mind writing one myself if someone could point me to a write-up of any of the algorithms.

Thanks,

Travis
0 Kudos
Message 5 of 5
(3,353 Views)