Calculating the mean of each cell of a series of matrices

To calculate the mean value of each cell of a series of Jitter matrices, you can keep the running sums in a matrix, and then divide by the number of instances received. That is, use jit.+ to keep the sum of all matrices received, use a counter to keep track of how many matrices you’ve received, and use jit./ to divide by that number (or jit.* to multiply by one over that number). In this example, a subpatch generates fake input data, and the rest of the patch shows the procedure for calculating the mean. Each jit.matrix object has been given a name, to show you what is being held in each one.

Chapter: 
Keywords: