prod
Returns vector or matrix element products.
Syntax
R = prod(x)
R = prod(x,dim)
Inputs
- A
- The argument from which to multiply elements.
- dim
- The dimension on which to multiply.
Outputs
- R
- The products of elements.
Examples
Vector:
R = prod([1,2,3])
R = 6
Matrix with default dimension:
R = prod([1,2,3;1,2,3;1,2,3])
R = [ 1 8 27 ]
Matrix with specified dimension:
R = prod([1,2,3;1,2,3;1,2,3],2)
R = [Matrix] 3 x 1
6
6
6
Matrix with all dimensions:
R = prod([1,2,3;1,2,3;1,2,3],'all')
R = 216