MATLAB Creating a MATLAB Function File Without Mod/Rem

Click For Summary
To create a MATLAB function that outputs the least possible value under modulo conditions from 3 to 9 without using mod() or rem(), one approach is to utilize basic arithmetic operations. A counter can be employed in a do-while loop to iterate through potential values, checking each one against the modulo conditions through subtraction instead of division. This method allows for multiplication to be performed via repeated addition and division through repeated subtraction, adhering to the professor's restrictions on using arrays or predefined functions. Further clarification on the specific requirements of Z3 to Z9 could enhance understanding of the task.
cpgarcia164
Messages
2
Reaction score
0
I need to create a MATLAB function file that will accept a modulo values (from 3 to 9; that is Z3 to Z9) and will output the least possible value describe by the modulo conditions

I don't know how to start it because I am not allowed to use the mod() and rem().

Please give me an idea how to do this, I badly need help with this oneI use array but my prof said it is prohibited because once I use matrix it is easy definable
 
Last edited by a moderator:
Physics news on Phys.org
don't quite understand what you are trying to do...it would help if you at least showed the "illegal" way that the prof does not want...but at least we would know what you are trying to achieve...or maybe I am just too ignorant and do not know what Z3 or Z9 is.

Say, can you just use a counter, a do loop and substraction? Multiplication can be achieve by summation and Division by substraction...does this help?
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 20 ·
Replies
20
Views
4K
  • · Replies 18 ·
Replies
18
Views
6K
  • · Replies 7 ·
Replies
7
Views
8K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K