Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here is the script function [convIn, inchLength, inchWidth, inchHeight, lengthOfCrates,logCrate, acceptableCrates, numbers] = myFunction(empireChoice, length, width, height) %load the data in, again, not a good

image text in transcribed

Here is the script

function [convIn, inchLength, inchWidth, inchHeight, lengthOfCrates,logCrate, acceptableCrates, numbers] = myFunction(empireChoice, length, width, height)

%load the data in, again, not a good idea for loading in a function in general

load('lab5Data','crateDim');

%Extract data into category length,width, and height from the crateDim

lengthofCrates=crateDim(:,1);

widthofCartes=crateDim(:,2);

heigthofCrates=crateDim(:,3);

%Assign conversion factor variable "convIn" to convert cubits into inches based on empire chosen using switch statement.

switch empireChoice

case 1

convIn=20.83;

case 2

convIn=20.42;

case 3

convIn=20.42;

case 4

convIn=18.20;

case 5

convIn=17.47;

otherwise

convIn=21.0;

end

%conversion of cubits into inches for length, width, and height based on empire chosen

inchLength=length*convIn;

inchWidth=width*convIn;

inchHeight=height*convIn;

%Find boolean vector (Nx1)of crates so that its dimensions (length, width, height) are able to hold given artifact

logCrate = lengthofCrates>=inchLength & widthofCartes>=inchWidth & heigthofCrates>=inchHeight;

%Extract only the indecies of acceptableCrates that can hold the given artifact

acceptableCrates = find(logCrate);

%Find the number of crates that satisfies the conditions, again the length() function can not be used here anymore since length is passed as a parameter,

%it redefine the meaning of length in this function. use size() or sum() instead, depends on what you will pass to these function.

numbers = size(acceptabelCrates,1);

end

Find large enough crates to hold antique 1 solution submitted (max: Unlimited) | View my solutions Problem Summary Mediterranean empires as he must ship the antiquities in plain wooden shipping crates to avoid alerting local and international authorities. crates and which standard commercial wooden shipping crates the antiquity could be shipped in (using the index numbers). The conversion factor from cubits to inches is not standard and depends on which culture/empire the antiquity is from: - Egyptian Royal Cubit: one cubit is 20.83 inches - Sumerian/Babylonian Cubit (kus): one cubit is 20.42 inches - Persian Cubit: one cubit is 20.42 inches - Greek Cubit (pechys): one cubit is 18.20 inches - Roman Cubit: one cubit is 17.47 inches - Others: one cubit is 21.0 inches so that a switch statement can be used to set the appropriate cubit conversion factor for the empire in your function. Examples of the use of the input function are shown: empireChoice = input('Choose an Empire: Egyptian (1) Sumerian (2) Persian (3) Greek (4) Roman (5) Other (6)'); width = input('Enter width in cubits: '); conversion factor is 20.83 inches, converted dimensions are 3124.5 by 239.545 by 781.125 inches, and none of the shipping crates are large enough

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is the market segmentation process?

Answered: 1 week ago