LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Moving standard deviation

Hello,

 

I am trying to take the moving standard deviation of a 2D array, and I'm super new to LabView.  The way I want this VI to work is to have it take data in 3 unit chunks, take the standard deviation, then put it into an array.  Then it would move over one unit then take the standard deviation of the next three units, and so on until it had finished with that row, then move down to the next row.  I have attached what I have done so far.  Basically, what's happening is the VI is taking the standard deviation of the first three, then moving both down one row and over one column, so it's kind of going diagonal across the array.  First time posting here so my apologies if I have made any social faux-paus.  Thanks in advance 🙂 

0 Kudos
Message 1 of 3
(2,765 Views)

First, the feedback nodes are unnecessary and your code in the outer for loop does nothing.

 

Feed the iteration (i) of the outer loop into the inner one (this will indicate the Row you are working on).  Use this and Index Array to get row i from the 2D array.  Then, use the iteration of the inner loop and Array Subset to get the values you want to use for calculating the St. Dev.  

0 Kudos
Message 2 of 3
(2,758 Views)

Make sure you understand how this little program works. There are a lot of array functions available for you on the pallette. Don't try to get too fancy, because you'll most likely just run into trouble (like you did with that "feedback node", with which I have no idea what you were trying to do).

 

By the way, you need at least 3 data points for a standard deviation, so you can only legitimately calculate two less than the number of data available in this situation.

 

(Looking at pjr's (Mr/Ms 1121's) post, I believe the attached is just what he said to do. Sorry for the spoiler.)

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 3 of 3
(2,715 Views)