How can I calculate the resistance of a color coded resistor based on its band color?
4 views (last 30 days)
Show older comments
I am working on a project to calculate the resistance & I need the code required for this task.
0 Comments
Answers (1)
Bshara Murr
on 20 Nov 2017
First each color is assigned to a number, you can search the internet for those. Now once you have those you start replacing the first two numbers by their values, say the first two colors are yellow(4) and red(2), you write 42 the third color would be the power of 10 multiplied by the number you got. Say brown(1) is the third color you will have now 42.10^1=420 ohms. The last color will be the tolerance.
As to the code you will have to write it yourself, i have already done most of the job for you but here's a hint, you ask the user to enter the first color and you get it with switch case, and replace each color by the corresponding number, or if you are not familiar with this method you can simply use "if" and "elseif" for each entered color. Good luck
0 Comments
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!