LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

3rd grade equation result different in formula than with primitives

Solved!
Go to solution

So, I was doing a bit of calibration using a modified version of the example curve fit VI found on help. So far so good, but when calibrating a load cell, I found it that after inputing the values, I was getting wildly different results on the equation than what I was supposed to be reading and, after digging around a bit more, what remains constant is the fact that the conversion gives me opposite sign result when done with primitive funcions (add, multiply nodes) than when done with a formula express VI, which DOES give me the correct value. Anyone know why this happens? The equation is a standard A + B*X + C*X^2 + D*X^3

 

Attached you will find a very simple layout with my 3 candidates; open "Wrap" for the main example VI, and input a value from -1 to 1 in the 4th square (index 3, zero indexed) of the array, which is the usual range I'll be working on and for the results the 3 VIs are as follows: one that uses barebones primitives (cumulative multiplication instead of power functions), one that uses more "advanced" primitives like x power y, and one made with formula express VI (didn't know how to input x^y so used x*x*x instead). Why am I getting incorrect results in the primitives? What am I missing?

0 Kudos
Message 1 of 4
(3,029 Views)

The global variable called constants is missing.

 

It would help if you included some screenshots that showed how the different versions are different in results.

0 Kudos
Message 2 of 4
(3,020 Views)
Solution
Accepted by topic author Daikataro

Okay I see it.

 

In the "primitives" one you have a compound arithemetic node that adds the values together.  You have the Invert mode turned on at the output of the node.  The little circle there indicates it.  That flips the sign of the result.

 

Not sure how you turned that on accidentally.  But if your right click on the output connector and unselect Invert Node, you'll make it match.

0 Kudos
Message 3 of 4
(3,017 Views)

Holy... I didn't even know that was possible! And I also have not the damnedest idea how in the world I turned that on, all I did was pull it from the numeric pallete, expand it and threw a bunch of numbers in there. No wonder it was doing weird stuff!

 

Well that's one problem crossed off the table, now I just have to make the values match but that's the least of my concerns, as I have a pretty solid idea already in my head. Thanks a bunch!

0 Kudos
Message 4 of 4
(2,988 Views)