Consider the following data regarding the resistance of various metals: Resistan
ID: 3870500 • Letter: C
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 function that behaves as described above (given the following 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.
The algorithm for your function should describe a function that accepts three input arguments/parameters (one for each of the arrays). It should save the result (the resistance of each metal) into another array, and return that as an output argument.
Consider that you will be provided arrays that contain the information for each of the relevant properties similar to the information below. The arrays will always have exactly four items in them. The first element in each array contains the information for the first metal. Likewise, the second element in each array contain the information for that metal, and so on. The three arrays might look like so. I’ve labeled each array element so that you can manually do the calculations for those metals to verify that your algorithm is correct.
(silicon) (copper) (aluminum) (gold)
metal_resistivities
.0023
. 000000017
.0000000282
.0000000244
wire_length_in_meters
1
5
25
50
wire_diam_in_mm
1
2
3
4
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.
Part 2 (Implementation) – due next friday:
Follow your instructions (the algorithm you wrote) and write a function in Matlab that can accept 3 separate arrays as parameters, calculate the resistance for all the metals in the arrays, and return the results as another array. You can use the arrays above as sample input if you’d like. Your output argument should contain a 1x4 array where each element contains the resistance of the metal for that same index of all of the other arrays. For example, the first element in result, is the resistance of all of the information from the first elements of the other arrays.
If necessary, rewrite your instructions (your algorithm) if you realize that you may have possibly described your instructions in such a way that they cannot be easily implemented in Matlab. If you rewrite your instructions, you MUST include them again with your code submission. This part is due the following Friday.
When you have finished writing your function, be sure to test it to make sure that it works. You may want to use the values I provided above, calculate it by hand, then compare it with what your script outputs.
When you have completed writing your function, submit your .m file on canvas as your submission. If you had to rewrite your algorithm, you must also provide the new algorithm.
.0023
. 000000017
.0000000282
.0000000244
Explanation / Answer
/* Let the input arrays be a,b,c where a store resistivities, b store lengths and c store diameters */
step 1: create array resistannce
step 2 : for each element i in resistance
step 3 : resistance[i] = a[i]*b[i]*4/(pi*c[i]*c[i]*10-6)
step 4: return resistance
step 5: end
MATLAB CODE :
function [ res ] = calcResistance( ro, len, dia )
res = zeros(1,length(ro));
for i=1:length(ro)
res(i) = ro(i)*len(i)*4*pow(10,6)/(pi*square(dia(i)));
end
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.