Question: NOTE: We do not normally assign an fprintf to a variable. However, here we need to in order for Matlab Grader to grade your work

NOTE: We do not normally assign an fprintf to a variable. However, here we need to in order for Matlab Grader to grade your work and compare your answer to the solution. For the purposes of this class, please do not assign fprintf commands to variables outside of Matlab Grader. Code has already been provided to define the following variables:
ResistorValues is a ten element row vector that contains the resistance values of ten resistors with integer values randomly assigned between 300 and 1300 ohms.
Series_or_Parallel is a character vector that is equal to 'S' to indicate a series connection, 'P' to indicate a parallel connection, or a different erroneous value, 'A'.
Add code below what is already provided to use the appropriate formula (as described above) to compute the equivalent resistance of a simple resistive circuit consisting of only series-connected or parallel-connected resistors. Your code should compute a scalar value that is the equivalent resistance of the circuit and assign that value to the variable EquivResistance.
At the end of your code, please use the fprintf command to output the equivalent resistance. Assign the fprintf to the variable output_resist. The fprintf text must be as follows: 'The equivalent resistance is XXX ohms.', where XXX represents the integer value of the equivalent resistance. Please be sure to include the period at the end and no
. Do not use any special formatting operators. Only use the % and the conversion character in place of the XXX.
Use a switch-case-otherwise-end structure in your solution.
Do not overwrite Series_or_Parallel or ResistorValues in your code. If the entered is erroneous, please assign a value of 0 to EquivResistance and use disp to output that there was 'Invalid Input.'
ResistorValues = randi([300,1300],1,10);
disp('The resistor values are:')
disp(ResistorValues)% This is just for your knowledge as a check when testing
pickOne = randi(3);
if pickOne ==1
Series_or_Parallel ='S'; % for series
disp('The circuit''s resistors are connected in series.')% for your knowledge when testing
elseif pickOne ==2
Series_or_Parallel ='P'; % for parallel
disp('The circuit''s resistors are connected in parallel.')% for your knowledge when testing
else
Series_or_Parallel ='A'; % for an erroneous value
disp('An erroneous value was entered.')% for your knowledge when testing
end
%Enter the code to solve the problme below this line.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!