| MATLAB Function Reference | ![]() |
Syntax
Description
M = mod(X,Y)
if Y ~= 0, returns X - n.*Y where n = floor(X./Y). If Y is not an integer and the quotient X./Y is within roundoff error of an integer, then n is that integer. The inputs X and Y must be real arrays of the same size, or real scalars.
The following are true by convention:
Remarks
rem(X,Y) for X~=Y and Y~=0 has the same sign as X.
mod(X,Y) and rem(X,Y) are equal if X and Y have the same sign, but differ by Y if X and Y have different signs.
The mod function is useful for congruence relationships: x and y are congruent (mod m) if and only if mod(x,m) == mod(y,m).
Examples
See Also
| mmfileinfo | more | ![]() |
© 1994-2005 The MathWorks, Inc.