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 = 23den = 5quotient = fix(num/den)modulus = num - quotient*denproducing: quotient = 4modulus = 3Also: modulus = (num/den - quotient) * denwith the same result. Related SolutionsMATLAB: The integer part of the division fix(23/5) % integer part rem(23,5) % remainder %or mod(23,5) MATLAB: How to make a function that checks the divisibility of a given number, n, by 3, 5, 7, and 11. This works:divisibility = @(x) rem(x, [3 5 7 11]) == 0;div = divisibility(14)producing:div = 0 0 1 0 Related QuestionProblem with mod and the value 2.3 times 100I am trying to solve this ques but I am getting some trouble. Write a custom function with the declaration: PPTask1p2_f(N) and save it in a file named PPTask1p2_f.m.The function loops through the values from 1 to N and for each number n it should dDiffrence between rem and modHow to find next number divisible by n
Best Answer