Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MATLAB QUESTION: Consider the following data regarding the resistance of various

ID: 3847291 • Letter: M

Question

MATLAB QUESTION: Consider the following data regarding the resistance of various metals:

Resistance of a metal = resistivity * length of wire / area of wire

Resistivity of silicon = 2.3 * 10^-3

Resistivity of copper = 1.7 * 10^-8

Length = 1, 85

Diameter (in mm) = 5, 2

Part 1 (Algorithms) – due Friday:

Think about how you might solve the problem of calculating the resistance of a given group of metals depending on the type of metal, the length of the wire and the area of the wire (if given the diameter only – so you must calculate the area). Write instructions (an algorithm) for a script that behaves as described above (given several arrays of information, calculates the resistance of each metal in the arrays). If given the correct information, the algorithm should be able to calculate the resistance of ANY metal that you have provided information for in the arrays.

Consider that you will be provided multiple arrays that contain the information for each of the relevant properties. For example, you might have 4 arrays that look like so:

metal_names

silicon

copper

aluminum

gold

germanium

metal_resistivities

.0023

. 000000017

.0000000282

.0000000244

.46

wire_length_in_meters

1

5

25

50

85

wire_diam_in_mm

1

2

3

4

5

The following link will take you to a page that displays some metal resistivity levels at 20 degrees Celsius. http://www.cleanroom.byu.edu/Resistivities.phtml

You might want to read part 2, to get a clearer idea of how your instructions should look.

Write your instructions (algorithm) in a separate word document. This part is due on Friday. When you have completed writing your algorithm, submit the word document to canvas as your assignment submission.

Here's what I have as my code, but MatLab is not happy with it:

Array_mn = [Silicon, Copper, Aluminum, Gold, Germanium];

Array_mr = [.0023, .000000017, .0000000282, .0000000244, .46];

Array_l = [1, 5, 25, 50, 85];

Array_d = [1:5];

Array_r = (Array_d)/2;

Area1 = Array_r(1)^2*pi;

Area2 = Array_r(2)^2*pi;

Area3 = Array_r(3)^2*pi;

Area4 = Array_r(4)^2*pi;

Area5 = Array_r(5)^2*pi;

Silicon_Resistance = (Array_mr(1))*(Array_l(1)/Area1)

Copper_Resistance = (Array_mr(2))*(Array_l(2)/Area2)

Aluminum_Resistance = (Array_mr(3))*(Array_l(3)/Area3)

Gold_Resistance = (Array_mr(4))*(Array_l(4)/Area4)

Germanium_Resistance = (Array_mr(5))*(Array_l(5)/Area5)

silicon

copper

aluminum

gold

germanium

Explanation / Answer

save this file as resistance.m

function result = resistance(name,resistivity,length,diameter)
radius = diameter/2;
area = pi*radius^2;
resistance = resistivity*length/area;
resistance = num2str(resistance);
result = strcat('Resistance of ',name,' :',resistance);
end