function setCenteredElement(matrix, l, i, j, gainValue) {
  const index = (j + l) * (2 * l + 1) + (i + l);
  // Row-wise indexing.
  matrix[l - 1][index].gain.value = gainValue;
}
A helper function to allow us to access a matrix array in the same
manner, assuming it is a (2l+1)x(2l+1) matrix. [2] uses an odd convention of
referring to the rows and columns using centered indices, so the middle row
and column are (0, 0) and the upper left would have negative coordinates.
@param {Number[]} matrix - N matrices of gainNodes, each with (2n+1) x (2n+1)
elements, where n=1,2,...,N.
@param {Number} l
@param {Number} i
@param {Number} j
@param {Number} gainValue