Creating a MATLAB Function File Without Mod/Rem

  • Context: MATLAB 
  • Thread starter Thread starter cpgarcia164
  • Start date Start date
  • Tags Tags
    File Function Matlab
Click For Summary
SUMMARY

The discussion centers on creating a MATLAB function file that computes modulo values from Z3 to Z9 without using the mod() and rem() functions. Participants suggest alternative methods, including using a counter, a do loop, and subtraction to achieve the desired results. The conversation emphasizes avoiding arrays and matrices, as these are deemed too straightforward for the assignment. The focus is on developing a solution that adheres to the constraints set by the professor.

PREREQUISITES
  • Understanding of MATLAB programming syntax and structure
  • Familiarity with basic control flow constructs in MATLAB, such as loops
  • Knowledge of mathematical concepts related to modulo operations
  • Ability to implement arithmetic operations using alternative methods
NEXT STEPS
  • Research how to implement loops in MATLAB for iterative calculations
  • Learn about arithmetic operations in MATLAB without using built-in functions
  • Explore the concept of modular arithmetic and its applications
  • Investigate MATLAB function file creation and best practices
USEFUL FOR

This discussion is beneficial for MATLAB programmers, students tackling algorithmic challenges, and anyone interested in creative problem-solving within programming constraints.

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
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 18 ·
Replies
18
Views
6K
  • · Replies 20 ·
Replies
20
Views
4K
  • · Replies 7 ·
Replies
7
Views
8K
  • · Replies 2 ·
Replies
2
Views
2K