LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

average rate of change 1d array

Solved!
Go to solution

Im frustrated at myself because this seems like it would be very simple and I'm stuck.

 

I have a 1D array of values. Id like to calculate the average rate of change for every set of 11 elements. I've already calculated by hand what im expecting and everything ive tried in labview is not matching up, I've tried the derivative function and shift registers. Maybe I'm just using the shift registers wrong, as I'm pretty new with using them.

 

Could anyone offer some advice or examples? Much appreciated, as always.

0 Kudos
Message 1 of 10
(5,023 Views)

Rate of change within those 11 samples, or rate of change between groups of 11 samples?



Bruce K

Not as smart as many other peepz on here....
0 Kudos
Message 2 of 10
(5,019 Views)

Within

0 Kudos
Message 3 of 10
(5,015 Views)

By average rate of change, do you simply mean [(last element) - (first element)] / 11 ? Or am I missing something?

0 Kudos
Message 4 of 10
(5,008 Views)

Maybe try something like this.  Split the array into 11 element arrays and put those into a linear fit vi.  One of the outputs is the slope.

 

You may need to create an x array to the input, I'm not quite certain, but this should have some key elements you could use.



Bruce K

Not as smart as many other peepz on here....
0 Kudos
Message 5 of 10
(5,007 Views)

no, I want (element2-element1) (element3-element2) (element4-element3) and so on until element 11, then divided by eleven, and then go through the whole cycle again so (element13-element12)(element14-13) and so on until element 22, divide by eleven, then again, and again...

0 Kudos
Message 6 of 10
(4,994 Views)

@libbyherself wrote:

no, I want (element2-element1) (element3-element2) (element4-element3) and so on until element 11, then divided by eleven, and then go through the whole cycle again so (element13-element12)(element14-13) and so on until element 22, divide by eleven, then again, and again...


I think you need to divide by 10, because with 11 elements, you only have 10 differences.

0 Kudos
Message 7 of 10
(4,981 Views)
Solution
Accepted by topic author libbyherself

Try something like this:

 

 

Message 8 of 10
(4,975 Views)

Thanks this worked perfectly. Turns out some of my "expected" values calculated were wrong which threw me off... It's always the silly mistakes that get me. But this solution is actually more simple than what I had so thank you. 

0 Kudos
Message 9 of 10
(4,963 Views)

@libbyherself wrote:

no, I want (element2-element1) (element3-element2) (element4-element3) and so on until element 11, then divided by eleven, and then go through the whole cycle again so (element13-element12)(element14-13) and so on until element 22, divide by eleven, then again, and again...


Expand your math out and you can make this a lot simpler.

[(B-A) + (C-B) + (D-C) + (E-D)]/4 = (E-A)/4

So you really could to the difference between the first and last elements and divide by the number of changes.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 10
(4,958 Views)