OENG1278 Project Report Template
OENG1278 Project Report Template
School of Engineering, STEM College
OENG1278 Digital Fundamentals
Practical Assessment Guidelines
1. Introduction
This report details the development of a MATLAB-based resistor color code
decoder. The primary objective of this practical exercise is to apply
fundamental MATLAB programming techniques, such as loops, conditional
statements, and user-defined functions, to interpret 4-band and 5-band
resistor color codes. The first part of the exercise focuses on creating a
text-based program that deciphers resistor values based on user input,
incorporating error handling and input validation. The second part extends
the program by introducing user-defined functions to handle the
mathematical calculations separately from the user interface, improving
modularity and efficiency.
2.Problem statement
This report details the development of a MATLAB-based resistor color code decoder. The
primary objective of this practical exercise is to apply fundamental MATLAB programming
techniques, such as loops, conditional statements, and user-defined functions, to interpret
4-band and 5-band resistor color codes. The first part of the exercise focuses on creating a
text-based program that deciphers resistor values based on user input, incorporating error
handling and input validation. The second part extends the program by introducing
user-defined functions to handle the mathematical calculations separately from the user
interface, improving modularity and efficiency.
3.Input Data:
The program decodes resistor values based on their color bands using the resistor color
code system. A resistor can have either 4 bands or 5 bands, where:
Page 2 of 6
The program takes input from the user using the input() function.
It accepts both numeric values (integer) for the resistor type and text (string) for color bands.
Conditional Statements: (ifelse, while)
Used to validate the resistor type input, ensuring only 4 or 5 is accepted.
The program also distinguishes between 4-band and 5-band resistors.
For the second part of the question the input data were as follows
The main script is responsible for handling user interaction and gathering input values. The
input data consists of:
Page 3 of 6
The function receives inputs from the main script and performs calculations.
The features used in the first and second part are almost the same except a few. The
features used in the second part that are not used in the first part are mentioned below:
The script calls the user-defined function ‘decode_resistor’ to calculate the resistance.
Feature: Separates user interaction (main script) from calculation logic (function).
The resistor color codes are stored in an array for easy lookup. Feature: Uses a structured
data type (struct) for key-value mapping.
3. Output Data
The output is displayed on the MATLAB command window using fprintf().
The resistance value is formatted to two decimal places for clarity.
The tolerance is displayed as a percentage (± %).
The unit (ohms, kilo-ohms, or mega-ohms) is automatically adjusted for readability.
%.2f ensures two decimal places for better readability.
The image of the command window after running the code is given below:
Page 4 of 6
4.Flowchart/ Algorithm
Page 5 of 6
5.Conclusion
The Resistor Color Code Decoder successfully interprets the resistance
value of 4-band and 5-band resistors based on user-input color codes. By
implementing input validation, the program ensures that only valid resistor
colors are processed, minimizing errors. The computed resistance and
tolerance are displayed in an easy-to-understand format, making this tool
useful for electronics enthusiasts, students, and engineers.
6.References
https://rmiteduau-my.sharepoint.com/:u:/r/personal/s4139804_student_rmit_e
du_au/_layouts/15/Doc.aspx?sourcedoc=%7B8A29C279-010F-40D8-9907-
DFA2AA4D85B5%7D&file=Drawing%205.vsdx&action=editnew&mobileredir
ect=true&wdTpl=TM11712902&wdlcid=1033&wdNewAndOpenCt=17419736
36064&ct=1741973637379&wdOrigin=OFFICECOM-WEB.START.NEW&wd
PreviousSessionSrc=HarmonyWeb&wdPreviousSession=0864b3a4-5bca-49
39-8e95-6873101c0f3f&cid=641b7457-db38-4b52-8916-3e0cb28e8403 :
was used in making the the flowchart
AI tools like ChatGpt was used in paraphrasing the sentences and tables in
input and output data.
Page 6 of 6