0% found this document useful (0 votes)
15 views6 pages

OENG1278 Project Report Template

This report outlines the development of a MATLAB-based resistor color code decoder that interprets 4-band and 5-band resistor values using programming techniques such as loops and user-defined functions. The program includes input validation and error handling to ensure accurate decoding based on user-specified color bands. The output displays the calculated resistance and tolerance in a clear format, making it a useful tool for electronics enthusiasts and professionals.

Uploaded by

dhruvsaxena208
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views6 pages

OENG1278 Project Report Template

This report outlines the development of a MATLAB-based resistor color code decoder that interprets 4-band and 5-band resistor values using programming techniques such as loops and user-defined functions. The program includes input validation and error handling to ensure accurate decoding based on user-specified color bands. The output displays the calculated resistance and tolerance in a clear format, making it a useful tool for electronics enthusiasts and professionals.

Uploaded by

dhruvsaxena208
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

OENG1278 Digital Fundamentals

Sample Project Report

Student Name: Dhruv Saxena

Student Number: s4139804


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:

●​ Each color band represents a digit, a multiplier, or a tolerance value.


●​ The user needs to specify the number of bands and the corresponding colors
for proper decoding.

Here’s a table of specifying the required input data:

​ Page 2 of 6

CRICOS provider number: 00122A | RTO Code: 3046


OENG1278 Digital Fundamentals
Practical Assessment Guidelines

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

1. Input Data for Main Script (resistor_main.m)

The main script is responsible for handling user interaction and gathering input values. The
input data consists of:

●​ Resistor Type (Integer input)


○​ The user selects the resistor type:
■​ 4 → 4-band resistor
■​ 5 → 5-band resistor
●​ Color Bands (String input)
○​ The user is prompted to enter the color of each band in lowercase.
○​ Inputs expected:
■​ First band (e.g., "red")
■​ Second band (e.g., "blue")
■​ Multiplier band (e.g., "orange")
■​ Third band (for 5-band resistors, e.g., "yellow")
■​ Tolerance band (e.g., "gold")

​ Page 3 of 6

CRICOS provider number: 00122A | RTO Code: 3046


OENG1278 Digital Fundamentals
Practical Assessment Guidelines

2. Input Data for User-Defined Function (decode_resistor.m)

The function receives inputs from the main script and performs calculations.

band1 → First band color (String, e.g., "red")


band2 → Second band color (String, e.g., "blue")
band3 → Multiplier band color (String, e.g., "orange")
band4 → Third band color (Only for 5-band resistors, otherwise '')
tolerance_band → Tolerance band color (String, e.g., "gold")

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).

Function Definition (function keyword)

●​ This function takes input parameters and returns output values.

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.

Here’s a summary in the form of a table of the output.

The image of the command window after running the code is given below:

​ Page 4 of 6

CRICOS provider number: 00122A | RTO Code: 3046


OENG1278 Digital Fundamentals
Practical Assessment Guidelines

4.​Flowchart/ Algorithm

​ Page 5 of 6

CRICOS provider number: 00122A | RTO Code: 3046


OENG1278 Digital Fundamentals
Practical Assessment Guidelines

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

CRICOS provider number: 00122A | RTO Code: 3046

You might also like