How can I calculate the resistance of a color coded resistor based on its band color?
조회 수: 1 (최근 30일)
이전 댓글 표시
I am working on a project to calculate the resistance & I need the code required for this task.
댓글 수: 0
답변 (1개)
Bshara Murr
2017년 11월 20일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!