Вы находитесь на странице: 1из 3

Assignment6AMATLABProgrammingSynthesisGeometryModule

(20points)
ThefollowingMATLABprogramswillhelpinthecreationofthesynthesisprogramthatis
requiredaspartofthesemesterproject.
Part1.
Createthreeseparatefunctionstofindthesurfaceandvolumeofthethreedifferentshapesthat
youworkedwithinPart2ofAssignment3B.Thismeansthatyouwillcreateonefunctionto
determinethesurfaceareaandvolumeofahemisphere,onefunctiontodeterminethesurface
areaandvolumeofarectangularcube,andonefunctiontofindthesurfaceareaandvolumeofa
cylinder.Usethefollowingnamesforyourfunctions(notethesewillbe.mfiles):
Cylareavol
Hsphereareavol
Boxareavol
Foryoursampleruns,pleaseuse
Aboxwithheight=4,width=3,length=2.
Acylinderwithradius=10,height=0.25.
Ahemispherewithradius=3
Noflowchartisrequiredforthispart.
Noteforthehemisphere,
do
includetheflatcircularportionofthehemisphereinthesurface
areacalculation.
Part2.
ModifyyourfunctionsfromPart1toalsofindthecentroidofeachofthoseobjectsandhavethat
informationshowninthecommandwindowalongwiththecalculatedsurfaceareaandvolume.
Yourreferenceoriginneedstobeexternaltotheobjectbecausethiscodewillbelateradaptedto
combinemultiplepartstorepresentyourprototypemodel.Foryoursampleruns,pleaseusethe
samevaluesasinpart1.
Asanexample,iftheaboxwithheight=3,width=8,length=1were
called,anacceptableinput/outputwouldbe:

>>[Vol,SurfA,BX,BY,BZ]=Boxareavol([3,8,1])
Box,assumesoriginatcornerofthebox

Theboxvolumeis24.000,theboxsurfaceareais70.000
Thecentroidoftheboxis[4.000.501.50]([xyz])
>>

Part3.
UsingwhatyouhavecreatedinPart2,createamainprogramthatpromptstheuserforallofthe
requiredinputs,storestheminavectorandcallsontheappropriatefunctionandoutputsthe
resultstothescreen.
Foryoursamplerun,pleaseusethesamevaluesfromPart1,witha
singlerunoftheprogram.
Asanexample,ifthe2objectswerecalled,oneahemispherewith
radius=5,andoneacylinderwithradius=4andheight=()boxwithheight=3,width=8,
length=1werecalled,anacceptableinput/outputwouldbe:

Thisprogramwilldeterminethesurfacearea,volumeandcentroidcoordinatesofthreedifferent
types
ofsolidobjects:ahemisphere,acylinder,andarectangularbox

Howmanyobjectsdoyouwanttofindthesurfaceareaandvolumefor?2
InputthetypeofobjecttobeanalyzedCforcylinder,Hforhemisphere,Bforbox:H
Hemisphere
Whatistheradius?5
Hemisphere,assumesoriginisoneradiusawayinx&yfromthecenterofthecircularflatside
Thevolumeofthehemisphereis261.799andthesurfaceareais235.619
Thex,y,zcoordinatesofthecentroidofthehemisphereare5.000,5.000,1.875

InputthetypeofobjecttobeanalyzedCforcylinder,Hforhemisphere,Bforbox:C
Cylinder
Whatistheradius?4
Whatisthecylinderheight?(2/5)

Cylinder,assumesoriginisoneradiusawayinx&yfromthecenterofthecylinder
Thevolumeofthecylinderis20.106andthesurfaceareais110.584
Thex,y,zcoordinatesofthecentroidofthecylinderare4.000,4.000,0.200

Createaflowchartforthisprogram.
Notetheflowchartsymboltouseforthefunctionis:

Deliverables
:
SubmittotheCanvassitethefollowingfor
eachpart
:
1. Your.mfile(s).Thefirstlineofyourcodemustbeacommentwithyourclass
identifier,yourname,andthedate.Youmustalsoaddcommentstoindicatethe
purposeoftheproblem.Addafewadditionalcommentsthroughoutthecodeto
explainthemainpartsofthecode.
2. Alistingofyour.mfiles(s)specifiedinDeliverable1above.
3. AscreenshotofasamplerunoftheprogramthatresultsfromcompletingPart3
ofthisassignment.Thesamplerunshouldshowbothyourinputandtheoutput.
(Youcansaveanimageofthecommandwindowshowingtheoutputandpaste
thisinyourhomeworkdocumenttextmustbelegible.)
4. FlowchartoftheprogramifspecifiedinthePartinstructions(i.e.Part3only).
Combinethedeliverablesspecifiedin2through4intoa
single
PDFthatissubmittedto
CanvasbytheduedateontheCanvaslink.Submitallofyour.mfilesforyour
programswiththePDFfile.

Вам также может понравиться