k-Wave Toolbox |
Enlarge a matrix by extending the edge values
mat_new = expandMatrix(mat, exp_coeff) mat_new = expandMatrix(mat, exp_coeff, edge_val)
expandMatrix
enlarges an input matrix by extension of the values at the outer faces of the matrix (endpoints in 1D, outer edges in 2D, outer surfaces in 3D). Alternatively, if an input for edge_val
is given, all expanded matrix elements will have this value. The values for exp_coeff
are forced to be real positive integers (or zero). Note, indexing is done inline with other k-Wave functions using mat(x)
in 1D, mat(x, y)
in 2D, and mat(x, y, z)
in 3D.
For example, running
mat = magic(3); expandMatrix(mat, 1) expandMatrix(mat, [2 0 1 0], 0)
will give the outputs
ans = 8 8 1 6 6 8 8 1 6 6 3 3 5 7 7 4 4 9 2 2 4 4 9 2 2 ans = 0 0 0 0 0 0 0 8 1 6 0 0 3 5 7 0 0 4 9 2
|
the matrix to enlarge |
|
the number of elements to add in each dimension, where
(here |
|
value to use in the matrix expansion |
|
expanded matrix |
resize
envelopeDetection | filterTimeSeries |
© 2009-2014 Bradley Treeby and Ben Cox.