Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MATLAB need help please! Comprehension Time: 10-15 min Background: Most resistors are so small that the actual value would be too difficult to read if
MATLAB need help please!
Comprehension Time: 10-15 min Background: 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. For the novice, however, trying to read color codes can be a bit challenging 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 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) 2 Red 6 Blue 7 Violet 8 Grey 9 White Ora Yellow Green Table 2: Multipliers (Multiplier) 10 100 Red 1000 10000 100000 1000000 Oran Yellow Blue 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. Load in P2_ColorGuide.mat, which contains the two above variables, and accomplish the tasks as described below Tasks: Proficiency Time: 35 min - 1 hr TASK 1 (5-10 min) Ask the validation on the menu selection: if the user exits out of the menu, produce an error that states that value in the menu and terminate the program. user whether they would like to con nce to color bands, or vice versa. Perform the following data the user did not select a vert resista - 25 min) istance, the user will enter a resistance (ohms) as a vector with each digit being a separate value in k that all digits entered after the first two digits are zeros. If they are not, produce an error message and m should display (in text) the color bands in the order they will appear on a resistor with If the user chooses terminate the program. The that resistance progra TASK 3 15-25 min color band, the user will enter the color band as one string array in a single input statement. Check that he ure only three colors entered. If not, your program should show an error message and terminate.The program should display the resistance in ohms. EXTRA CREDIT Output ut the resistance with the symbol for ohms (0) in the command window (+5 pts) resistanee Sample Output: Sample output for given data: Additional test case scenarios are described in the MA3 rubric. Sample Output to Command Window based on the two conversion options: tance to Color Bands (the first case shown is an example of an incorrect input causing an error): Command Window Converting Resistance to color Band Enter the resistance in ohms as a vector: [1 5 0 0 61 Error using MA3_cougarnetID (line 52) Invalid resistance entered. Converting Resistance to Color Band Enter the resistance in ohms as a vector: I1 0 0 01 Program terminated j The color bands for that resistance are: Brown Black Red>> | Color Bands to Resistance: Command Window Converting Color Bands to Resistance Enter the color bands as a string array of 3 colors: ["Black", "Green " , "Orange"] ft The resistance for the given color bands is 5000
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started