MATLAB: In documentation it says mod(a,m) will give the remainder of a/m with example mod(23,5) = 3. However 23/5 is 4.6, 4 with a remainder 6 not 3. Whats going on here

mod vs divide

a = mod(23,5)
b = 23/5

Best Answer

You are misinterpreting the mod function.
Illustrating —
num = 23
den = 5
quotient = fix(num/den)
modulus = num - quotient*den
producing:
quotient =
4
modulus =
3
Also:
modulus = (num/den - quotient) * den
with the same result.