LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform averaging

The array size is ok.  Also, the plot after the addition is correct.  The problem comes when I divide by the iteration number.  The waveform data is 64-bit real and the iteration number is 32-bit integer.  Does LabVIEW operate on these numbers differently which could be causing the problem?
0 Kudos
Message 11 of 32
(1,549 Views)

That shouldn't be the problem...

 

So when you add them, they are correct.  It's only the division that gets to be a problem.  Can you give us an example of the inputs to the division (just one or two array elements) and the output of the division node?

 

-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




0 Kudos
Message 12 of 32
(1,545 Views)

Something is happening in either the frist or second iteration because the data before and after the division is off by one iteration when you divide the two results.  For example,

 


On the third iteration:  Before division:  3.75413                        After Division:        1.87707

                                                               3.70394                                                      1.85197

 

These should be different by a factor of three not two.

0 Kudos
Message 13 of 32
(1,535 Views)

OK, so can you put a probe on the other input of the division node and see if that is what you expect (I suspect it isn't).  I would guess that you would have to add one to your divisor before dividing, but I'm not sure.

 

 

-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




0 Kudos
Message 14 of 32
(1,528 Views)

Hi jtd,

 

you know LabView starts to count with zero (as many other programming languages do as well)?

So the third iteration is number two, will perfectly explains that division results are just half of the value before division...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 15 of 32
(1,511 Views)
Yeah, I agree -- but then the bizarre part would be that he would be dividing by 0 on the first iteration.  That would cause an error, and he would never get to the next iteration -- but he is, so something is going on.
-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




0 Kudos
Message 16 of 32
(1,504 Views)
Yes I know about the iteration count starting at zero.  I am dividing by 1 + i.  I suspect that somehow my feedback loop is not correctly returning the first set of data to the loop for the second iteration but somehow it does start to pick it up after that.
0 Kudos
Message 17 of 32
(1,492 Views)

Hi Matt,

 

division by zero results in NaNs - there will be no error message...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 18 of 32
(1,489 Views)
Excuse me for stepping into the middle but I think the flaw is with the addition. On the first loop, you add it with your initialized array. You should not be adding it to anything. Look at the simplified VI below. On the first iteration, it just writes the waveform to the shift register.
0 Kudos
Message 19 of 32
(1,475 Views)
Is it just me or is the forum going ultra-slow this morning? Dennis -- no excusing necessary. Your help is always appreciated (the purpose of the board is supposed to be to help each other, not feed our own egos.) GerdW -- true about the NaN, but then that would carry over to each loop execution so you would never get anything other than NaN. I'd look at the code that Dennis posted but I don't have 30+ minutes to wait for the download right now.
-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




0 Kudos
Message 20 of 32
(1,455 Views)