Professional Documents
Culture Documents
Section: 1
In a color-coding technique, the resistors value is marked on the resistors body by using colors. The colors
painted on the resistors body are called color bands. All the color bands painted on the resistor body are used
to indicate the resistance value and tolerance. The 1st color band on the resistor denotes the first significant
value or first digit of the resistor’s resistance and the second color band denotes second significant value or
second digit of the resistor’s resistance. The third color band is the decimal multiplier, and the fourth color
band shows the resistors tolerance. The first along with second color bands collectively make it to up a two-
digit number and the third color band or multiplier is multiplied with this two-digit number to achieve the
Objective:
The main objective of this project is to implement a MATLAB program that calculates
Methodology:
The following are the main steps in MATLAB CODE used in the carrying out the projects:
• In the second step used switched statement to achieve the desired output regarding 4
different bands
Check and Compare the strings and assign the value accordingly
Check and Compare the strings and assign the value accordingly
Check and Compare the strings and assign the value accordingly
Check and Compare the strings and assign the value accordingly
Then calculate the resistor value using the formula Resistor = Band1*Band3*10+Band2*Band3
Flowchart
MATLAB CODE
% for Band-1
switch true
case strcmp(Band1,'brown') == 1
B1 = 1;
case strcmp(Band1,'red') == 1
B1 = 2;
case strcmp(Band1,'orange') == 1
B1 = 3;
case strcmp(Band1,'yellow') == 1
B1 = 4;
case strcmp(Band1,'green') == 1
B1 = 5;
case strcmp(Band1,'blue') == 1
B1 = 6;
case strcmp(Band1,'voilet') == 1
B1 = 7;
case strcmp(Band1,'gray') == 1
B1 = 8;
case strcmp(Band1,'white') == 1
B1 = 9;
otherwise
end
% for Band-2
switch true
case strcmp(Band2,'black') == 1
B2 = 0;
case strcmp(Band2,'brown') == 1
B2 = 1;
case strcmp(Band2,'red') == 1
B2 = 2;
case strcmp(Band2,'orange') == 1
B2 = 3;
case strcmp(Band2,'yellow') == 1
B2 = 4;
case strcmp(Band2,'green') == 1
B2 = 5;
case strcmp(Band2,'blue') == 1
B2 = 6;
case strcmp(Band2,'voilet') == 1
B2 = 7;
case strcmp(Band2,'gray') == 1
B2 = 8;
case strcmp(Band2,'white') == 1
B2 = 9;
otherwise
end
% for Band-3
Band3 = input('Enter Band 3 Color: ','s');
switch true
case strcmp(Band3,'black') == 1
B3 = 0;
case strcmp(Band3,'brown') == 1
B3 = 10;
case strcmp(Band3,'red') == 1
B3 = 100;
case strcmp(Band3,'orange') == 1
B3 = 1000;
case strcmp(Band3,'yellow') == 1
B3 = 10000;
case strcmp(Band3,'green') == 1
B3 = 100000;
case strcmp(Band3,'blue') == 1
B3 = 1000000;
case strcmp(Band3,'voilet') == 1
B3 = 10000000;
case strcmp(Band3,'gray') == 1
B3 = 100000000;
case strcmp(Band3,'white') == 1
B3 = 1000000000;
otherwise
end
% for Band-4
Band4 = input('Enter Band 4 Color: ','s');
switch true
case strcmp(Band4,'None') == 1
B4 = 0.2;
case strcmp(Band4,'silver') == 1
B4 = 0.1;
case strcmp(Band4,'gold') == 1
B4 = 0.05;
otherwise
end
R = B1*B3*10 + B2*B3;
R_H = R+R*B4;
R_L = R-R*B4;
Test 1
Test 2
Conclusion:
It is concluded that we leaned that MATLAB software is a very efficient software to get
desired program. And this language syntax is very proficient as compared to other
MATLAB using switch cases and four input prompts, and we got the perfect and accurate
desired result. Band 5 and 6 technique can also implement in MATLAB as improvement in
existing program.
References:
1. Shaik, A., 2020. Resistor Color Code - 4 Band, 5 Band And 6 Band Resistors. [online] Physics-and-
devices-and-circuits/passive components/resistors/
resistorcolorcode.html#:~:text=In%20a%20color%20coding%20technique,the%20resistance%20val