LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does the divide operator give me different results in different VIs?

Solved!
Go to solution

Hi all,

 

I'm quite the LabVIEW newbie, so please forgive me if this is elementary.  I have a signal I am acquiring.  The signal is fairly low amplitude (.01 - 0.1 V).  On each acquisition, I divide the values in the sample set by another small number (0.047) using the divide operator.  I am seeing inconsistent results and I'm puzzled as to why.

 

In ex1, which I built from scratch for this post, everything works as expected.  I can confirm with the debugger that each reading in the sample set is properly divided and the mean, max, and waveform graph look as I'd expect.

 

When I use a similar construct in my real application, however, the division often results in INF, and when I look with the debugger I see post-divide values in the signal that...just don't make sense to me (ex2).

 

I figured I must be missing something in the real application related to splitting up and merging multiple signals, so I tore out everything unrelated to the division (ex3).  Although this code looks a lot like the properly-functioning ex1, the division still produces INFs and strange results.

 

All three examples are acquiring the same signal.  My best guess at this point is that the built-from-scratch example is coercing the double passed to the divide operator "the right way" and that the malfunctioning examples are coercing the double in a different, incorrect way.  I've tried removing and recreating the signal path in the malfunctioning examples to no avail.  My problem is that I don't know enough about LabVIEW data types to know how to force the proper coercion.

 

Can anyone point me in the right direction for a solution?  I would greatly appreciate some help.

 

 

Download All
0 Kudos
Message 1 of 4
(2,458 Views)
Solution
Accepted by topic author indelible
Your first image is dividing your signal by 0.047. Your second and third images are dividing 0.047 by your signal. Reverse your wires into the divide nodes on image 2 and 3 and I think you should be ok.
Message 2 of 4
(2,434 Views)

I may be getting old, and my eyesight isn't as good as it can be, but I can clearly see that in example 2 and 3 you are not dividing by 0.047. So example 2 and 3 are not the same operation as example 1. The outputs of example 2 and 3 are completely dependent on the signals you are getting. Have you actually looked at those? You are using dynamic data which regulars such as myself absolutely detest. Be that as it may, you should look at the values you are feeding into the operation. I don't understand what you mean by "I see post-divide values in the signal".

Message 3 of 4
(2,431 Views)

Bingo.  Boy is my face red.  Thanks all.

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