Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: Distingusih between rem and mod
Posted:
Jan 22, 2013 7:39 AM


On 1/22/2013 2:33 AM, Aung Kaung Myat wrote: > I am a Matlab beginner and I want to know clearly between the usage of > rem and mod functions. Though I've read in help documents, I still > don't accurately know.I'd like to know exactly how to use these > functions.Explain me please. From http://www.mathworks.com/help/matlab/ref/rem.html the Tips section:
rem(X,Y) and mod(X,Y) are equal if X and Y have the same sign, but differ by Y if X and Y have different signs.
Definitions: R = rem(X,Y) if Y ~= 0, returns X  n.*Y where n = fix(X./Y). B = fix(A) rounds the elements of A toward zero, resulting in an array of integers. M = mod(X,Y) if Y ~= 0, returns X  n.*Y where n = floor(X./Y). B = floor(A) rounds the elements of A to the nearest integers less than or equal to A.
Alan Weiss MATLAB mathematical toolbox documentation



