LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiplying by small polynomial coefficients output from curve fit vi and getting unexpected results

Solved!
Go to solution

I'd appreciate it if someone could shine some light on this problem for me.

 

I am performing a polynomial regression with the Curve Fitting express VI.  The express VI itself is working fine.  I have used the polynomials it outputs to graph a function in Excel and it looks perfect.

 

When I convert the signal to an array and then multiply it by other values things start to go south.

 

The results of multiplications are erroneous when certain "x" values are used.  The strange thing to me is that this does not occur for all values of x.

 

Not sure if this is useful but the expected values for x0 through x5 (bottom right, below) are:

 

x0: -1.14

x1: 16.11

x2: 6. 19E-3

x3: -3.39E-4

x4: 6.76E-7

x5: -2.08E-7

 

and the values shown when the routine runs are:

 

x0: -1.14

x1: 16.11

x2: 25.57

x3: -925.06

x4: 104.25

x5: -2017.87

 

Any ideas?  I'm thinking a data type needs to be changed since the expected values are very small and the problem is only present for certain values of x.

 

If that is the case I'm not sure how to change the data type.  The array contains doubles when converted from the signal form.

 

Thanks for any help,

 

Dave

 

 

 

x.jpg

0 Kudos
Message 1 of 3
(3,519 Views)

Hi,

 

could you clean up your code before posting it? Currently I cannot clearly see where the wires exactly runs.

 

There is also a set of VIs to calculate data with polynomials:

Polynomial VIs especially the Polynomial Evalutation

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 2 of 3
(3,511 Views)
Solution
Accepted by topic author davey31415

Hi TCPlomp,

 

I just realized that I had x and y inverted in my "power of x" function inputs. 

 

 

Thanks for letting me know about the polynomial VIs.  Adding those should be nicer than trying to clean this up.

 

Regards,

 

Dave

 

 

0 Kudos
Message 3 of 3
(3,495 Views)