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

Matlab Help I created this function. but need to edit it. If the given waist and

ID: 3661721 • Letter: M

Question

Matlab Help

I created this function. but need to edit it.
If the given waist and chest measurements fit more than one size, the function must return the smallest size that fits.

What do I need to add or change?

function ShirtSize=computeShirtSize(chest,waist)
c=chest;
w=waist;
if c<38 | c>50 | w<30 | w>43
ShirtSize=('Not available');
elseif (c>=38 & c<=42) & (w>=30 & w<=35)
ShirtSize=('Small');
elseif (c>=40 & c<=44) & (w>=32 & w<=37)
ShirtSize=('Medium');
elseif (c>=42 & c<=46) & (w>=34 & w<=3)
ShirtSize=('Large');
elseif (c>=44 & c<=48) & (w>=36 & w<=41)
ShirtSize=('X-Large');
elseif (c>=46 & c<=50) & (w>=38 & w<=43)
ShirtSize=('XX-Large');
end

Explanation / Answer

elseif (c>=42 & c<=46) & (w>=34 & w<=3)

In this statement the measurement you have entered is wrong, it should be (w>=34 & w<=36)

Now consider the input we give

waist=40

Chest=42

these are also valid measurements, in this case try applying these values to your computesize function, there are no matching criteria at all which means the range coverage you have specified in the function needs to be reframed.

So, Instead of using &(and) condition between chest and waist measurements and |(or) condition can be used, that can be meaningful, but still it returns more than one matching criteria and by reframing the measurement criteria with or the output could be derived.