Question
MATLAB question: I have written a code to solve for a metals resitance. Here is the problem statement: Part 1 (Algorithms) due Friday: Think about
MATLAB question: I have written a code to solve for a metals resitance. Here is the problem statement:
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.
Part 2 (Implementation) due next friday:
Follow your instructions (the algorithm you wrote) and write a script in Matlab that can read in information from 4 separate arrays and calculate the resistance for all the metals in the arrays. You can use the arrays above as sample input if youd like. Be sure to name them THE SAME AS THEYRE NAMED ABOVE. The function should calculate the resistance of all the metals in the arrays using the formula above, and should output the result to the command window.
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 script, 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 scrip, submit your .m file on canvas as your submission. If you had to rewrite your algorithm, you must also provide the new algorithm. In this case, you should zip up BOTH the algorithm (word document) AND the script (.m file) and submit just a single zip file.
NOTE: The metal names array metal_names is going to be a cell array. As far as this assignment is concerned, the ONLY difference for you will be that you MUST use curly brackets { } instead of square brackets [ ] to create it (if you want to test your own code, that is). Other than that you can use it EXACTLY THE SAME WAY as you would use a regular array for this assignment.
For example, the following arrays:
test_array = { one string, another string } Cell array of strings
numeric_array = [ 10 20 ] numeric array of doubles
are just 1 x 2 arrays. The first is a cell array of strings, the second is a regular array of numbers. You would reference the elements EXACTLY THE SAME WAY that you would reference a regular arrays contents. So:
test_array(1) This would display: one string
numeric_array(1) This would display: 10
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.
Part 2 (Implementation) due next friday:
Follow your instructions (the algorithm you wrote) and write a script in Matlab that can read in information from 4 separate arrays and calculate the resistance for all the metals in the arrays. You can use the arrays above as sample input if youd like. Be sure to name them THE SAME AS THEYRE NAMED ABOVE. The function should calculate the resistance of all the metals in the arrays using the formula above, and should output the result to the command window.
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 script, 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 scrip, submit your .m file on canvas as your submission. If you had to rewrite your algorithm, you must also provide the new algorithm. In this case, you should zip up BOTH the algorithm (word document) AND the script (.m file) and submit just a single zip file.
NOTE: The metal names array metal_names is going to be a cell array. As far as this assignment is concerned, the ONLY difference for you will be that you MUST use curly brackets { } instead of square brackets [ ] to create it (if you want to test your own code, that is). Other than that you can use it EXACTLY THE SAME WAY as you would use a regular array for this assignment.
For example, the following arrays:
test_array = { one string, another string } Cell array of strings
numeric_array = [ 10 20 ] numeric array of doubles
are just 1 x 2 arrays. The first is a cell array of strings, the second is a regular array of numbers. You would reference the elements EXACTLY THE SAME WAY that you would reference a regular arrays contents. So:
test_array(1) This would display: one string
numeric_array(1) This would display: 10
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.
Part 2 (Implementation) due next friday:
Follow your instructions (the algorithm you wrote) and write a script in Matlab that can read in information from 4 separate arrays and calculate the resistance for all the metals in the arrays. You can use the arrays above as sample input if youd like. Be sure to name them THE SAME AS THEYRE NAMED ABOVE. The function should calculate the resistance of all the metals in the arrays using the formula above, and should output the result to the command window.
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 script, 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 scrip, submit your .m file on canvas as your submission. If you had to rewrite your algorithm, you must also provide the new algorithm. In this case, you should zip up BOTH the algorithm (word document) AND the script (.m file) and submit just a single zip file.
NOTE: The metal names array metal_names is going to be a cell array. As far as this assignment is concerned, the ONLY difference for you will be that you MUST use curly brackets { } instead of square brackets [ ] to create it (if you want to test your own code, that is). Other than that you can use it EXACTLY THE SAME WAY as you would use a regular array for this assignment.
For example, the following arrays:
test_array = { one string, another string } Cell array of strings
numeric_array = [ 10 20 ] numeric array of doubles
are just 1 x 2 arrays. The first is a cell array of strings, the second is a regular array of numbers. You would reference the elements EXACTLY THE SAME WAY that you would reference a regular arrays contents. So:
test_array(1) This would display: one string
numeric_array(1) This would display: 10
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.
Part 2 (Implementation) due next friday:
Follow your instructions (the algorithm you wrote) and write a script in Matlab that can read in information from 4 separate arrays and calculate the resistance for all the metals in the arrays. You can use the arrays above as sample input if youd like. Be sure to name them THE SAME AS THEYRE NAMED ABOVE. The function should calculate the resistance of all the metals in the arrays using the formula above, and should output the result to the command window.
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 script, 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 scrip, submit your .m file on canvas as your submission. If you had to rewrite your algorithm, you must also provide the new algorithm. In this case, you should zip up BOTH the algorithm (word document) AND the script (.m file) and submit just a single zip file.
NOTE: The metal names array metal_names is going to be a cell array. As far as this assignment is concerned, the ONLY difference for you will be that you MUST use curly brackets { } instead of square brackets [ ] to create it (if you want to test your own code, that is). Other than that you can use it EXACTLY THE SAME WAY as you would use a regular array for this assignment.
For example, the following arrays:
test_array = { one string, another string } Cell array of strings
numeric_array = [ 10 20 ] numeric array of doubles
are just 1 x 2 arrays. The first is a cell array of strings, the second is a regular array of numbers. You would reference the elements EXACTLY THE SAME WAY that you would reference a regular arrays contents. So:
test_array(1) This would display: one string
numeric_array(1) This would display: 10
Here is my code:
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];
size = size(Array_mn);
% resistances (array of numbers with size elements)
for i = 1:size
resistances(i) = Array_mr(i)*Array_l/(pi*(Array_d(i)/2)^2);
end
for i = 1:size
print "Resitance of metal" + Array_mn(i) + ":is" + Array_mr(i)
end
Matlab will not accept this and cannot figure out why. Please Help!
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