11-12-2009 01:01 PM
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
Solved! Go to Solution.
11-12-2009 01:18 PM
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
11-12-2009 02:25 PM
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