OrchardPublications®withEngineeringApplicationsSecondEditionStevenT.KarrisOrchardPublications®withEngineeringApplications,SecondEditionCopyright©2008OrchardPublications.Allrightsreserved.PrintedintheUnitedStatesofAmerica.Nopartofthispublicationmaybereproducedordistributedinanyformorbyanymeans,orstoredinadatabaseorretrievalsystem,withoutthepriorwrittenpermissionofthepublisher.DirectallinquiriestoOrchardPublications,info@orchardpublications.comProductandcorporatenamesaretrademarksorregisteredtrademarksofTheMathWorks™,Inc.Theyareusedonlyforidentificationandexplanation,withoutintenttoinfringe.LibraryofCongressCataloging-in-PublicationDataLibraryofCongressControlNumber2008923972ISBN-10:1-934404-10-1ISBN-13:978-1-934404-10-2TXu1−303-668DisclaimerTheauthorhasmadeeveryefforttomakethistextascompleteandaccurateaspossible,butnowarrantyisimplied.Theauthorandpublishershallhaveneitherliabilitynorresponsibilitytoanypersonorentitywithrespecttoanylossordamagesarisingfromtheinformationcontainedinthistext.PrefaceThistextisanintroductiontoSimulink®,acompanionapplicationtoMATLAB®.Itiswrittenforstudentsattheundergraduateandgraduateprograms,aswellasfortheworkingprofessional.Theauthorclaimsnooriginalityofthecontent,andthedescriptionoftheSimulinkblocksisextractedfromTheMathWorks™documentationwithoutintenttoinfringe.Theintentistoprovideacompletereferencetext,andwhenevernecessary,theauthorrefersthereadertoTheMathWorks™documentation.WheneverthereisaconflictbetweenthistextandTheMathWorks™documentation,thelattertakesprecedence.AlthoughsomepreviousknowledgeofMATLABwouldbehelpful,itisnotabsolutelynecessary;AppendixAofthistextisanintroductiontoMATLABtoenablethereadertobeginlearningbothMATLABandSimulinksimultaneously,andtoperformgraphicalcomputationsandprogramming.Chapters2through19describetheblocksinallSimulinkVersion7.1libraries.TheirapplicationisillustratedwithSimulinkmodelsthatcontainthepertinentblocks,andsomearesupplementedwithMATLABfunctions,commands,andstatements.Somebackgroundinformationisprovidedforlesserknowndefinitionsandtopics.Chapters1and20containseveralSimulinkmodelstoillustratevariousappliedmathandengineeringapplications.AppendixBisanintroductiontomaskedsubsystems,andAppendixCintroducesthereadertorandomgenerationprocedures.AppendixDisanintroductiontoWeightedMovingAverages.ThistextsupplementsourNumericalAnalysisUsingMATLABandExcel,ISBN978−1−934404−03−4.Itisself-contained;theblocksofeachlibraryaredescribedinanorderlyfashionthatisconsistentwithSimulink’sdocumentation.Thisarrangementprovidesinsightintohowamodelisusedandhowitspartsinteractwitheachanother.LikeMATLAB,Simulinkcanbeusedwithbothlinearandnonlinearsystems,whichcanbemodeledincontinuoustime,sampletime,orahybridofthese.Examplesareprovidedinthistext.MostoftheexamplespresentedinthisbookcanbeimplementedwiththeStudentVersionsofMATLABandSimulink.Afewmayrequirethefullversionsoftheseoutstandingpackages,andtheseexamplesmaybeskipped.Someadd−ons,knownasToolboxesandBlocksetscanbeobtainedfromTheMathWorks,™Inc.,3AppleHillDrive,Natick,MA,01760-2098,USA,’sGuides.Otherreferencesareprovidedinthereferencesectionofthistext.Thisisthesecondeditionofthistitle,andalthougheveryeffortwasmadetocorrectpossibletypographicalerrorsanderroneousreferencestofiguresandtables,somemayhavebeenoverlooked.Accordingly,theauthorwillappreciateitverymuchifanysucherrorsarebroughttohisattentionsothatcorrectionscanbemadeforthenextedition.TheauthorwishestoexpresshisgratitudetothestaffofTheMathWorks™,thedevelopersofMATLAB®andSimulink®fortheencouragementandunlimitedsupporttheyhaveprovidedmewithduringtheproductionofthistext.OurheartfeltthanksalsotoMr.HowardR.Hansen,andDr.NielRansom,formerCTOofAlcatel,forbringingsomeerrorsonthefirstprinttoourattention.OrchardPublications@orchardpublications.comIntroductiontoSimulinkwithEngineeringApplications,SecondEditioniCopyright©OrchardPublicationsTableofContents1IntroductiontoSimulink1−11.1SimulinkanditsRelationtoMATLAB....................................................................1−11.2SimulinkDemos......................................................................................................1−201.3Summary..................................................................................................................1−281.4Exercises..................................................................................................................1−291.5SolutionstoEnd−of−ChapterExercises..................................................................1−302TheCommonlyUsedBlocksLibrary2−12.1Inport,Outport,andSubsystemBlocks................................................................2−22.2GroundBlock.................................