Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Resistor Decoder (Application to Electrical and Computer Engineering) Background Comprehension Time: 10 - 15 min Most resistors are so small that the actual value would

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Resistor Decoder (Application to Electrical and Computer Engineering) Background Comprehension Time: 10 - 15 min Most resistors are so small that the actual value would be too difficult to read if printed on the resistor. Instead, colored bands denote the value of resistance in ohms. Anyone involved in constructing electronic circuits must become familiar with the color code and with practice, one can tell at a glance what value a specific set of colors means. When reading a resistor's color bands: The first two colored bands, pulled from Table 1, represent the first and second digits of the resistance, respectively The third colored band, pulled from Table 2, represents the multiplier applied to the first two digits. For example, if there are three zeros after the first two digits, that would be represented by an orange color as the third colored band. If there are no zeros after the first two digits, that would be represented by a black color as the third colored band. See test cases below for additional examples. Table 1: Color Codes (ColorCode) 0 1 2 3 5 6 7 8 Black Brown Red Orange Yellow Green Blue Violet Grey Table 2: Multipliers (Multiplier) 1 10 100 1.000 10,000 100,000 1.000.000 Black Brown Red Orange Yellow Green Blue 9 White The goal of this program is to convert a given resistance into a set of color bands or convert a given set of color bands into a resistance value. The file, ColorGuide.mat, contains the two above variables necessary to complete this problem, Task 1: (5 - 10 min) Main Script Ask the user whether they would like to convert resistance to color bands, or vice versa. Perform the following data validation on the menu selection: if the user exits out of the menu, produce an error that states that the user did not selecta value in the menu and terminate the program. Load in the provided data file, ColorGuide.mat. Task 2: (15-20 min) Function Develop a user-defined function named Resist2 Color to convert a resistance [ohms) to its corresponding color band, Assume that the resistance has been formatted in the form of a vector, where every digit is a different element in the vector. Determine the corresponding color band using Tables 1 and 2. Function Inputs: Function Outputs: 1. Resistance (ohms) as a vector, with each digit 1. Color bands corresponding to the inputted being a separate value in the vector resistance, as a string vector with each color a 2. The vector, ColorCode (Table 1) separate element in the vector 3. The vector, Multiplier (Table 2) The function header should be formatted similarly to the following: function (outl] - Resist2Color(ini, in2, in3) Remember you are free to use whatever variable names you want, but they must be listed in the same order as given in the input/output lists provided above. Checkpoint Once the function Resist2Color has been developed, navigate to Zybooks. Chapter 32, Zylab 32.1. Copy and paste ALL of the code for Resist2Color into the submission window, Task 3:(15 - 20 min) Function Develop a user-defined function named ColorResist to convert a color band to its corresponding resistance [ohms). Assume that the color band has been formatted in the form of a vector, where every color is a different element in the vector. Determine the corresponding resistance [ohms) using Tables 1 and 2. You may assume that the color names inputted will always match the case sensitivity shown in Tables 1 and 2. Function Inputs: Function Outputs: 1. Color band as a vector, with each color being a 1. The resistance [ohms) corresponding to the separate value in the vector inputted color band 2. The vector, Color Code (Table 1) 3. The vector, Multiplier (Table 2) Resistor Decoder (Application to Electrical and Computer Engineering) Background Comprehension Time: 10 - 15 min Most resistors are so small that the actual value would be too difficult to read if printed on the resistor. Instead, colored bands denote the value of resistance in ohms. Anyone involved in constructing electronic circuits must become familiar with the color code and with practice, one can tell at a glance what value a specific set of colors means. When reading a resistor's color bands: The first two colored bands, pulled from Table 1, represent the first and second digits of the resistance, respectively The third colored band, pulled from Table 2, represents the multiplier applied to the first two digits. For example, if there are three zeros after the first two digits, that would be represented by an orange color as the third colored band. If there are no zeros after the first two digits, that would be represented by a black color as the third colored band. See test cases below for additional examples. Table 1: Color Codes (ColorCode) 0 1 2 3 5 6 7 8 Black Brown Red Orange Yellow Green Blue Violet Grey Table 2: Multipliers (Multiplier) 1 10 100 1.000 10,000 100,000 1.000.000 Black Brown Red Orange Yellow Green Blue 9 White The goal of this program is to convert a given resistance into a set of color bands or convert a given set of color bands into a resistance value. The file, ColorGuide.mat, contains the two above variables necessary to complete this problem, Task 1: (5 - 10 min) Main Script Ask the user whether they would like to convert resistance to color bands, or vice versa. Perform the following data validation on the menu selection: if the user exits out of the menu, produce an error that states that the user did not selecta value in the menu and terminate the program. Load in the provided data file, ColorGuide.mat. Task 2: (15-20 min) Function Develop a user-defined function named Resist2 Color to convert a resistance [ohms) to its corresponding color band, Assume that the resistance has been formatted in the form of a vector, where every digit is a different element in the vector. Determine the corresponding color band using Tables 1 and 2. Function Inputs: Function Outputs: 1. Resistance (ohms) as a vector, with each digit 1. Color bands corresponding to the inputted being a separate value in the vector resistance, as a string vector with each color a 2. The vector, ColorCode (Table 1) separate element in the vector 3. The vector, Multiplier (Table 2) The function header should be formatted similarly to the following: function (outl] - Resist2Color(ini, in2, in3) Remember you are free to use whatever variable names you want, but they must be listed in the same order as given in the input/output lists provided above. Checkpoint Once the function Resist2Color has been developed, navigate to Zybooks. Chapter 32, Zylab 32.1. Copy and paste ALL of the code for Resist2Color into the submission window, Task 3:(15 - 20 min) Function Develop a user-defined function named ColorResist to convert a color band to its corresponding resistance [ohms). Assume that the color band has been formatted in the form of a vector, where every color is a different element in the vector. Determine the corresponding resistance [ohms) using Tables 1 and 2. You may assume that the color names inputted will always match the case sensitivity shown in Tables 1 and 2. Function Inputs: Function Outputs: 1. Color band as a vector, with each color being a 1. The resistance [ohms) corresponding to the separate value in the vector inputted color band 2. The vector, Color Code (Table 1) 3. The vector, Multiplier (Table 2)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Second International Conference Acids Hue City Vietnam March 2010 Proceedings Part 1 Lnai 5990

Authors: Manh Thanh Le ,Jerzy Swiatek ,Ngoc Thanh Nguyen

2010th Edition

3642121446, 978-3642121449

More Books

Students also viewed these Databases questions

Question

How We Listen?

Answered: 1 week ago