Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Dr. Su has decided this engineering career thing is not working out and decides to quit his job and become a mlade man for unscrupulous

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Dr. Su has decided this engineering career thing is not working out and decides to quit his job and become a mlade man for unscrupulous traders selling antiquities. As part of this new cars, the most deal with lengths in ancient units from Mediterranean empires as he must ship the antiquities in plain wooden shipping crates to avoid alting local and national authorities To help him out wille a MATLAB function that will get the empire and the dimensions of the minimum cuboid volume (ong with and height in cubits that would encompass converse dimensions to inches, and determine how many cats and which standard commercial wooden shipping crates the antiquity could be shipped in using the index number The conversion factor from oubit to Inches is not standard and depends on which culturalempire the antiquity is from Egyptian Royal Cubietoine cu 20.63 inches . Sumerian Babylonian Cubitusyon bis 20:42 inches Persian Cubitone ubi20:42 inches . Greek Cunit pechysk one cubitis 18.20 inches Roman Cubit one cubitis 17 47 inches . Ofers, one cutit is 21.0 inches The wooden shipping crite dimensions are stored in the MATLAB wypocet named about the crimento (ength, with high in inches we stored in the Nysay Punta The empire and dimensions should be read in using the MATLAB Trout function in your main program. The MATLAB input function will display a prompt and read in a value. The empre designation should be an integer corresponding to the empire so that a witch statement can be used to set the appropriate oubit conversion factor for the empre in your function Barries of the use of the function are shown pretholce input choose an Empirer Eeptian (1) Sumerian (3) Persim ) Greek (4) Ronan (5) Other (6) width = Input('Inter width in cubits >> For example, if your instructor wanted to ship the Egyptian Sphinx home because it would look good in his back yard the cuboid dimensions are 150 by 11.5 by 37,5 cubits, the empire in Egyptian corresponding Integer value of 1) so the Royal Cub conversion factor is 20.83 inches, converted dimensions are 31245 by 230.545 by 781125 inches, and none of the shipping crates are large enough 1 Function convin, Inchength, inchwidth, incheight, lengthof Crates, logCrate, acceptablecrates, numbers] = myFunction(errechoice, length, width, hent) load the data in, again, not a good idea or loading in a function in general load('labsata','crates); Extract data into category length width and height from the crate lengthorCrates widthofcrates- besightofcrates mission conversion factor variable convinto convert cubits into inches based on pre chosen tire switch statt twitch empireChoice 13 13 end 1 18 conversion of cubits into inches for length width and helent based on enpire chosen inchLength - chwidth - 1 Inchheight Find boolean vector (of crates so that its dinensions (length, with, heleht) are able to hold uten artifact logcrate- Extract only the indecies of acceptablecrates that can hold the given artifact acceptablecrates 18 Find the number of crates that satifies the conditions, again the length() function cannot be used here anymore since length is sed as a purter it redefine the meaning of length in this function, use size() or () instead, depends on what you will pass to the function numbers 4 and Code to call your function Reathering choices by user in order to perform correct conversion capireChoice - 1; input('Choose an Empire: Teyptian (1) Sumerian (2) Persian (3) Greek (4) Roman (6) Other (6) length - 1; input("Enter length in cubits: ') width 2; Ninot("Enter width in cubits: "); height = 1; input('Enter height in cubits: "); 14 [convin, inchlength, inclwidth, inchheight, longthorcrates, locrate, acceptablecrates, numbers) syFunction(epinechoice, length, wath, height) 11 displaying crates able to hold artifact 11t (isempty(acceptablecrates) forintf(there are no crates able to hold your artifact (3.27 3.27 3.27 INCHES). Inchength, inchidth, incheight); 1 else print there are xd crates which are large enough to hold your artifact (tax.27 WX28 3.24 INCHES), is listed below the numbers, inclunt, inchon, inch disp(acceptablecrates); 10 end The MATLAB program as follow was designed to sum an array and display the sum of the array is not empty and does not contain any negative values. The program has several error: correct the syntax Tuntime, and logic errors and verty that the program operates correctly for the three test cases First correct any syntax errors To help identify runtime and logic errors use the MATLAB debugger (On your own installation, and set breakpoints at each of the statements in the blocks of the statements. Using the debugger, Identity and correct the program logic errors (watch which block of the conditional statement is executed for the test cases and ensure the correct operation is being performed based on the test case Verily the program operates correctly for all the test cases Dt. So has decided this engineering career thing is not working out and decides to quit his job and become a middle man for unscrupulous traders seting antiquities. As part of his new career, he must de with lengths in ancient units from Mediterranean empires as he must ship the antiquities in plain wooden shipping crates to avoid alerting local and international authorities To help hem out, write MATLAB function that will get the empire and the dimensions of the minimum cuboid volume (length width and height) in cubits that would encompass the antiquity, convert the dimension to inches, and determine how many 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 cudempire the antiquity is from Egyptian Royal Cubitono cubit is 20.83 inches . Bumerabylonian Cuti (wa), one outils 20.42 inches Persian Cutitione cubit is 20 42 inches Cubicone 18 20 inches Roma Concubiti 17.4 inches Osone cutitis 21. ches The wooden shipping crate dimensions are stored in the MATLAB workspace fle named labsata.nat. The crate dimensions dength width, height in inches are stored in the N by 3 array crates The emple and dimensions should be read in using the MATLAB input function in your main program. The MATLAB input function wil display a prompt and read in a value. The empire designation should be an integer corresponding to the empre so that a switch statement can be used to set the appropriate oubit conversion factor for the empire in your function. Examples of the use of the input function are show notrechote.input'choose an trole textian (1) sumerlan () Persian >> Grook (4roman (5) Other (6 with rout('Inter with in cubits!) 1 function convin, inchlength, inchwidth, inchheight, lengthofCrates, logcrate, acceptablecrates, numbers] = myFunction(ompireChoice, length, width, height) Kload the data in, again, not a good idea for loading in a function in general load('lab sata, cratebi' Extract data into category length,width, and height from the cratein lengthorCrates widthof Crates Jeightofcrates Kassign conversion factor variable "convinto convert cubits into inches based on empire chosen using switch statement. switch empireChoice conversion of cubits into inches for length, width and height based on empire chosen inchLength incwidth- inchlight- 12 Find boolean vector (of crates so that its dimensions (length, width, height) are able to hold given artifact lucrate stract only the inductes of acceptablecrates that can hold the elven artifact acceptablecrutes - Find the number of crates that satifies the conditions, in the length() function cannot be used here anymore since length is passed as parameter: uit redefine the meaning of length in this function. use sire) or sun() instead, depends on what you will pass to these function Code to call your function C Rosa Fathering choices by user in order to perform correct conversion empirethoice = 1; input (Choose an Empire: Egyptian (1) Sorian (2) Persian (3) Greek (4) Roman (5) Other (6) '); Length - 1. input("Enter length in cubits: "); width. 2: Kimputinter with in cubits): heleht -1; input("Enter helicht in cubits [comin, Inchength, inchwidth, inchielpt, lengthofcrates, locrate, acceptablecrates, numbers] wyFunctionempreChoice, length, width, het) displaying crates able to hold artifact if (ty(acceptablecrates) print There are nu crtus anilo to hold your artifact (0.27 WIX.2.2 INCHES) Incheneth, incwidth, inchicht: forintfThere**d crater which are large enoue to hold your artstart (41% I NINTHIA. ), s listed below numbers, inteneth, indth, an is acceptablecrates) 11 end

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

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions

Question

Outline the regulations governing overtime pay.

Answered: 1 week ago

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago