mod
Returns x modulo y.
Syntax
R = mod(x, y)
Inputs
- x
- Dividend.
- y
- Divisor.
Outputs
- R
- Remainder.
Examples
Simple scalar
input:
R = mod(-1, 3)
R = mod(15, -5)R = 2
R = 0Scalar matrix
input:
R = mod(10, [4,-3])
R = mod([10,15], -6)R = [ 2 -2 ]
R = [ -2 -3 ]Matrix
input:
R = mod([10,15], [7, 4])R = [ 3 3 ]Comments
mod(x, y) function computes x - y .* floor(x ./ y)