LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

linear vs polynomial order 1 curve fit VI

Solved!
Go to solution

In LabVIEW 2011, I'm using the curve fit express VI.  The linear fit does a poor job fitting to data, but polynomial order 1 works great (but I can't extract the coefficients).  Why does one work well but the other doesn't?

 

linear.PNG

 

polynomial1.PNG

 

0 Kudos
Message 1 of 15
(4,376 Views)

Wierd -- Linear = Polynomial Order 1 (look at the equations being fit -- they're the same, just use different names for the two coefficients).  Not sure why Linear has such a huge offset ...

 

BS

0 Kudos
Message 2 of 15
(4,372 Views)

@mparagano wrote:

In LabVIEW 2011, I'm using the curve fit express VI. 


There's your problem, right there! 😄 How to the regular tools (=non-express) handle the same data?

 

Seriously, if you want help, attach your VI and include your problem data. We cannot debug pictures.

 

 

Is the fit really wrong or is it just a cosmetic issue on the express panel? Just looking at the graph, I cannot see how the offset can be 20k. It seesm <<1.

0 Kudos
Message 3 of 15
(4,368 Views)

So here's the relevant parts of the VI.  It's a real issue, not just the express panel.  Right now I'm just reading in a nearly constant voltage the curve fit jumps above and below the data as it's running (in linear mode), but in poly order 1 mode it's fine.  I've noticed the residual is 0 for both cases...

 

EDIT:  Also haven't tried the non-express version, mostly because I'm not familiar with LabVIEW's matrix tools to take apart the signal into X/Y components.

 

 

0 Kudos
Message 4 of 15
(4,353 Views)
You don't need any matrix tools. It's all plain arrays.
0 Kudos
Message 5 of 15
(4,348 Views)
If the residual shows as zero, you need to adjust the formatting.

(Posting via phone, cannot look at your VI at the moment)
0 Kudos
Message 6 of 15
(4,335 Views)

@mparagano wrote:

So here's the relevant parts of the VI.


A more relevant part is the data. Remove the DAQ parts and substitute typical data instead. We cannot troubleshoot your VI witout data.

 

(... and please don't maximize the front panel and diagram to the screen. That's very irritating!)

0 Kudos
Message 7 of 15
(4,310 Views)

When I asjust the formatting, I see that the residuals are all integer values and periodically the rediual jump from single digits to 10^9.

0 Kudos
Message 8 of 15
(4,301 Views)

Is there a way to extract the coefficients from a polynomial fit?

0 Kudos
Message 9 of 15
(4,299 Views)
Solution
Accepted by topic author mparagano

There could also be a problem if your x (time) values are gigantic, such as when you use absolute time in the signals, but the Y values are very small. The problem will get ill conditioned. (see also this discussion).

 

Sorry, I don't have DAQ installed, so I cannot look at your DAQ assistants, but are they configured for absolute time or relative time?

Message 10 of 15
(4,297 Views)