2 ICollaboration Loops are very useful for doing the same ca

2. ICollaboration] Loops are very useful for doing the same calculation over and over, very quickly. Let\'s assume that we are building a bridge and need to determine the grade of steel we need for each fastener. Assume that we have another set of programs that returns the tensile and shear forces that each joint will experience. We need to use the program we have already written to determine which kind of fastener to use en masse. As we want to store the data about fastener type in an array of numbers, please use the following values for each grade of steel: Steel Grade String Grade 1 Low Carbon Steel Grade 2 Low Carbon Steel Grade 5 Medium Carbon Steel Grade 8.2 Low Carbon Boron Steel Number Code 8.2 Write program that takes in two arrays, the first with shear forces, the second array of the same length with tensile forces, for fastened joints. As an output, this function returns the type of metal to use in those joints. You can assume that no shear Forces are above 120000 and that no tensile forces are above 150000. Please call your function from Recitation 3 problem 1 to solve this. For example, if ShearForces = [10000, 100000,50000] And: TensileForces 125000, 120000,75000] Then: Grades]-aaa111Recitation5Problem2 (ShearForces, TensileForces) Will return the array: Grades = [ 1,82,5] Remember that you can use stremp to compare two strings, if you want to use it to solve this problem. You can also use length(arrayName) to determine the length of any array. You can download an example recitation problem 3.1 answer if yours was incorrect Please rename it correctly, PLEASE SUBMIT YOUR PROGRAM FROM RECITATION 3 PROBLEM WITH THE REST OF YOUR SUBMISSIONS FOR THIS RECITATION

Solution

MATLAB CODES

Save the function with a filename same as the function name and kept in the same folder.

--------------------------------------- aaalllRecitation5Problem2.m-------------------------------------

function [ Grades ] = aaalllRecitation5Problem2( ShearForces,TensileForces )
N = length(ShearForces); % determin the number of situations to be checked
Code = [1 2 5 8.2 ]; % Number code of different grades of steel
for i = 1:N % loop to check each situation
% Calling the function aaalllRecitation2Problem1 to determin the
% type of steel
MyMaterialGrade = aaalllRecitation2Problem1(ShearForces(i),TensileForces(i));
% Comparing the output of the function to get the correct number
% code
if strcmp(MyMaterialGrade,\'Grade 1 Low Carbon Steel\')
Grades(i) = Code(1);
elseif strcmp(MyMaterialGrade,\'Grade2 Low Carbon Steel\')
Grades(i) = Code(2);
elseif strcmp(MyMaterialGrade,\'Grade 5 Medium Carbon Steel\')
Grades(i) = Code(3);
elseif strcmp(MyMaterialGrade,\'Grade 8.2 Low Carbon Boron Steel\')
Grades(i) = Code(4);
end
end
end

------------------------------ aaalllRecitation5Problem2.m -----------------------------------------------

-----------------------------aaalllRecitation3Problem1.m ---------------------------------------------------

function [ MyMaterialGrade] = aaalllRecitation2Problem1(Shear,Tension)

if Shear<= 33000 && Tension<=60000
MyMaterialGrade = \'Grade 1 Low Carbon Steel\';
elseif Shear<=55000 && Tension<= 74000
MyMaterialGrade = \'Grade 2 Low Carbon Steel\';
elseif Shear<=85000 && Tension<= 120000
MyMaterialGrade = \'Grade 5 Medium Carbon Steel\';
elseif Shear<=120000 && Tension<= 150000
MyMaterialGrade = \'Grade 8.2 Low Carbon Boron Steel\';
end
end

--------------------------------- aaalllRecitation3Problem1.m ---------------------------------------------------

Sample OUTPUT

>> ShearForces = [10000,100000,50000];
>> TensileForces = [25000,120000,75000];
>> [ Grades ] = aaalllRecitation5Problem2( ShearForces,TensileForces )

Grades =

1.0000 8.2000 5.0000

 2. ICollaboration] Loops are very useful for doing the same calculation over and over, very quickly. Let\'s assume that we are building a bridge and need to de
 2. ICollaboration] Loops are very useful for doing the same calculation over and over, very quickly. Let\'s assume that we are building a bridge and need to de

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site