Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Distingusih between rem and mod
Replies: 1   Last Post: Jan 22, 2013 7:39 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Alan Weiss

Posts: 1,374
Registered: 11/27/08
Re: Distingusih between rem and mod
Posted: Jan 22, 2013 7:39 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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.

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

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2015. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.