Use help to determine the difference between the rem and mod functions
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:1| Question number:27.1
All Answers
total answers (1)
>> help rem rem Remainder after division. rem(x,y) is x - n.*y where n = fix(x./y) if y ~= 0. By convention: rem(x,0) is NaN. rem(x,x), for x~=0, is 0. rem(x,y), for x~=y and y~=0, has the same sign as x. 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. >> help mod mod Modulus after division. mod(x,y) is x - n.*y where n = floor(x./y) if y ~= 0. By convention: mod(x,0) is x. mod(x,x) is 0. mod(x,y), for x~=y and y~=0, has the same sign as y.
need an explanation for this answer? contact us directly to get an explanation for this answer