2 ICollaboration Loops are very useful for doing the same ca
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](/WebImages/11/2-icollaboration-loops-are-very-useful-for-doing-the-same-ca-1006294-1761518796-0.webp)
![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](/WebImages/11/2-icollaboration-loops-are-very-useful-for-doing-the-same-ca-1006294-1761518796-1.webp)