ebook img

A Matlab Primer for Technical Programming for Materials Science and Engineering PDF

276 Pages·2020·26.335 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview A Matlab Primer for Technical Programming for Materials Science and Engineering

® A MATLAB Primer for Technical Programming in Materials Science and Engineering ® A MATLAB Primer for Technical Programming in Materials Science and Engineering Leonid Burstein An imprint of Elsevier WoodheadPublishingisanimprintofElsevier TheOfficers’MessBusinessCentre,RoystonRoad,Duxford,CB224QH,UnitedKingdom 50HampshireStreet,5thFloor,Cambridge,MA02139,UnitedStates TheBoulevard,LangfordLane,Kidlington,OX51GB,UnitedKingdom ©2020ElsevierInc.Allrightsreserved Nopartofthispublicationmaybereproducedortransmittedinanyformorbyanymeans,electronicor mechanical,includingphotocopying,recording,oranyinformationstorageandretrievalsystem,without permissioninwritingfromthepublisher.Detailsonhowtoseekpermission,furtherinformationaboutthe Publisher’spermissionspoliciesandourarrangementswithorganizationssuchastheCopyrightClearance CenterandtheCopyrightLicensingAgency,canbefoundatourwebsite:www.elsevier.com/permissions. ThisbookandtheindividualcontributionscontainedinitareprotectedundercopyrightbythePublisher (otherthanasmaybenotedherein). Notices Knowledgeandbestpracticeinthisfieldareconstantlychanging.Asnewresearchandexperiencebroadenour understanding,changesinresearchmethods,professionalpractices,ormedicaltreatmentmaybecomenecessary. Practitionersandresearchersmustalwaysrelyontheirownexperienceandknowledgeinevaluatingandusingany information,methods,compounds,orexperimentsdescribedherein.Inusingsuchinformationormethodstheyshould bemindfuloftheirownsafetyandthesafetyofothers,includingpartiesforwhomtheyhaveaprofessionalresponsibility. Tothefullestextentofthelaw,neitherthePublishernortheauthors,contributors,oreditors,assumeanyliabilityforany injuryand/ordamagetopersonsorpropertyasamatterofproductsliability,negligenceorotherwise,orfromanyuseor operationofanymethods,products,instructions,orideascontainedinthematerialherein. LibraryofCongressCataloging-in-PublicationData AcatalogrecordforthisbookisavailablefromtheLibraryofCongress BritishLibraryCataloguing-in-PublicationData AcataloguerecordforthisbookisavailablefromtheBritishLibrary ISBN:978-0-12-819115-6(print) ISBN:978-0-12-819116-3(online) ForinformationonallWoodheadpublications visitourwebsiteathttps://www.elsevier.com/books-and-journals Publisher:MatthewDeans AcquisitionEditor:GlynJones EditorialProjectManager:EmilyThomson ProductionProjectManager:SojanP.Pazhayattil CoverDesigner:GregHarris TypesetbySPiGlobal,India Dedication Inmemoryof my parents—Matveyand Leda To my wife Inna,and myson Dmitri Preface Scientists, engineers, and students in materials science and engineering (MSE) perform extensivetechnicalcalculationsandapplycomputersandsomespecialprogramsforthis. ® MATLAB isaverypopularsoftwareusedintechnicalcomputingbecauseofitsefficiency and simplicity. This book presents a primer in technical programming in MATLAB with examples from the field of materials science, and addresses a wide MSE audience— undergraduateandgraduatestudentsandpracticingengineers.ItprovidestheMATLAB fundamentalswithavarietyofapplicationexamplesandproblemstakenfrommaterials engineering, physics of materials and properties of substances, and material phenome- non simulations that should facilitate learning the software language.I hope that many nonprogrammerstudents,engineers,andscientistsfromMSEfieldwillfindthesoftware convenient for solving their specific problems. The book accumulates many years of teaching experience in introductory and advanced courses in the fields of MATLAB, material properties, and tribology that were lecturedfor students,engineers, and scientists specializinginthe areainquestion. Ithank MathWorks Inc.,awhichkindly granted permission to use certain materials.I am also grateful to the Elsevier Inc.b for permission to use the text, tables, figures, and screenshots from my previous book “MATLAB in Quality Assurance Sciences” (Amster- dam—Boston—Cambridge—Heidelberg—London—New York—Oxford—Paris—San Diego—San Francisco—Singapore—Sydney—Tokyo,2015). IwouldalsoliketoexpressappreciationtoStephenRifkind,ITARecognizedTranslator, who edited thebook. Ihopetheprimerwillproveusefultostudents,engineers,andscientistsinMSEareas and enablethem toworkwith the availablefine software. Anyreportsoferrataorbugs,aswellascommentsandsuggestionsonthebookwillbe gratefullyaccepted bythe author Leonid Burstein ORT BRAUDE COLLEGE OF ENGINEERING, SOFTWARE ENGINEERING, KARMIEL, ISRAEL aTheMathWorks,Inc.,3AppleHillDrive,Natick,MA01760-2098,UnitedStates.Tel:+1-508-647-7000; Fax:+1-508-647-7001.E-mail:[email protected];Web:www.mathworks.com. bThebookwaspublishedbytheWoodheadPublishingthatisanimprintofElsevierInc.,50HampshireSt., 5thFloor,Cambridge,MA02139,UnitedStates.Tel:+1-617-661-7057;Fax:+1-617-661-7061.E-mail: [email protected];Web:https://www.elsevier.com. ix 1 Introduction Theworldismaterial:alldifferentnaturalobjects,plants,products,machines,andeven ourselves, are designed from various materials. Knowledge of the structure of matter as wellastheabilitytocreatenewandbettermaterialswiththedesiredpropertiesareamong themostimportantgoalsofsciencesandengineeringingeneralandthescienceofmate- rialsinparticular.Naturally,inmaterialssciencesandengineering(MSE),asinothertech- nological areas, calculations and computer modeling are widely used. For this purpose, ® variouskindsofsoftwareareused.Amongthem,MATLAB hasbecomeoneofthemost widespread and popular in programming for various technical applications. However, a ® student,teacher,orMSEspecialistjustbeginningtousetheMATLAB soondiscoversthat ® eachoftheavailableMATLAB booksisdesignedforawiderangeofspecialistsandthat thereisnotextbookspecificallyaimedfortheproblemsthatareencounteredintechnical programmingintheMSEfields.Overall,alargecommunityoftechniciansneedsacon- cise,comprehensivetextthatiseasytounderstandandprovidesquickaccesstothenec- essary tool. The presented editionaimsto fill this gap. 1.1 Some history ® The theoretical basics of the MATLAB language were established in the 1970s by the mathematicianCleveMolerandperfectedbythespecialiststhatjoinedhim.First,thelan- guagewasorientedtotheadaptationofthemathematicalpackagesofthattime,LINPACK ® and EISPACK. In a short time, MATLAB was considered by students and engineers an effective and suitable tool not only for mathematical but also for many technical prob- ® lems. The language was rewritten in C. Commercial MATLAB versions have appeared sincethemid-1980sinthegeneralsoftwaremarket.Byincorporatinggraphicsanddevel- ® opment of the special engineering-oriented means—toolboxes—MATLAB acquired its ® modern outlines. In general, MATLAB is a unique assembly of implemented modern numerical methods and specialized tools for engineering calculations developed over ® thepastdecades.MATLAB competeswithothersoftwareandhasestablisheditsspecial placeasthesoftwarefortechnicalcomputations.Withoutgoingintodetail,thefollowing ® factorsand theircombinations provide advantages to MATLAB : (cid:129) Versatility and the ability to solveboth simple and complex problems with its easy-to-use facilities; (cid:129) Highestadaptability to differentareasof engineering and science asreflected in a significant number ofthe problem-oriented toolboxes; AMATLAB®PrimerforTechnicalProgramminginMaterialsScienceandEngineering https://doi.org/10.1016/B978-0-12-819115-6.00001-0 ® 2 AMATLAB PrimerforTechnicalProgramminginMaterialsScienceandEngineering (cid:129) Convenience and avarietyof visualization means for generaland specific problems,e.g.,MSEproblems; (cid:129) Quick, simpleaccess towell-organized,extensive documentation. 1.2 Purpose and audience of the book ThepurposeofthisprimeristoprovideMSEstudents,academicians,teachers,engineers, andscientistswithaguidethatwillteachthemhowtocreateprogramssuitablefortheir professional calculations and present the results in descriptive, graphical, and tabular forms. It is assumed that the reader has no programming experience and will be using the software for the first time. In order to make the primary programming steps and useofcommandscleartothetargetaudience,theyaredemonstratedbyproblemstaken from different areas ofmaterials science whenever possible.Among the variety ofavail- ® able software, MATLAB distinguishes itself asthe tool for technicalanalysis and calcu- lations.Itisrenewedandrefinedinparallelwiththedevelopmentsinmoderntechnology. Modernmaterialsciencesspecialistsintensivelyusedcomputerswithsomespecialpro- grams,andthereforeneedauniversaltoolforsolvingspecificproblemsfromtheirarea. ® Thus, the book serves as a guide to MATLAB with examples from the field of material engineering and is addressed to undergraduate, graduate, and postgraduate students as ® wellasnonprogrammertechniciansthatwanttomastertheMATLAB programtosolve problems arisingin their areas. ® MostoftheexistingbooksonthevariousaspectsofMATLAB canberoughlydivided ® intotwokinds:(a)MATLAB programmingbooksand(b)advancedengineering,science, ® ormathematicsbookswithMATLAB -introductorysection/s.Thefirstcategoryassumes thatthereaderisalreadyfamiliarwithmathmethodsandconcentratesonprogramming technique. The second category is generally devoted to special subjects on a somewhat advanced level. This book is different in that it assumes the reader possesses a modest mathematical background and introduces the programming or technical concepts ® togetherwithatraditionalapproach.MATLAB isthenusedasatoolforsubsequentcom- putersolutions,applyingittomechanicalandmaterialscienceproblems.Anadditional distinctionofthebookisitsrelativelycompactsizecombinedwithavarietyofexamples fromabroadrangeofmodernandclassicalmechanicsandmaterialsciences,whichhelp solidifythe understanding ofthe presented material. Inaccordancewith the foregoing, the principalaudiences of the book include: – Students, engineers,managers,and teachersfrom the academic and scientific communities in the field ofmaterials science; – InstructorsandtheirstudentsinMSEstudyprogramcourseswhereMATLAB®isused asasupplemental but necessary tool; – Personnel at materials testing laboratories,students, and nonprogrammersusing ® MATLAB ; Chapter 1 (cid:129) Introduction 3 – Students and participants in advancedMSE courses,seminars, or workshops where ® MATLAB is taught; – ScientistswhoseektosolveMSE-scientificproblemsandsearchforsimilarproblems ® solvable with MATLAB ; – Self-instructing readers as ameans ofquickmasteringof MATLAB®for their needs. Thebookwillalsoservenon-MSEspecialistsasareferenceinnumericalapplicationsthat requirea computer tool for modeling and solving actual engineering problems. 1.3 About the book topics Thetopicswereselectedbasedonmorethan20yearsofresearchexperienceand15years ofteachingexperienceinthefieldsoftribology,materialsandsubstancesproperties,and ® MATLAB . They were presented so that the beginner can progress gradually using only previously acquiredmaterial as prerequisites foreach new chapter. ® The most important, basic MATLAB features, including the desktop environment, languagedesign,helpoptions, variables,arithmeticalandalgebraicfunctions andoper- ations, matrix and array creation and manipulations with their flow chart control, and conditionalstatements,areintroducedinthesecondchapter.Acommandofthismaterial enables the reader to write, execute, and display the simple calculations directly in the commandwindow. Thethirdchapterpresentsvisualizationmeansbyexamplesofvarioustwo-andthree- dimensionalplotsrepresentingtheactualcalculations.Understandingthematerialofthe ® secondandthirdchaptersallowsthereadertocreaterathercomplexMATLAB programs for technicalcalculations and their graphicalrepresentation. Thefourthchaptershowshowtocreateprogramsintheformofscriptsoruser-defined functions and then save them as an m-file. The chapter includes the Live Editor, live scripts,andfunctiondescriptionsanddemonstratestheirusebytheMSE-orientedexam- ple.Inthis chapter, the supplementary commands forcommon numerical calculations, such as finding the solution of the equation, inter- and extrapolation, differentiation and integration, are discussedtogether with examples from the MSEfields. The fifth chapter presents more advanced topics, including the fitting experimental, tabular, or theoretical data. Polynomial fitting, fitting by optimization, and the use of the Basic Fitting interface are described with both single and the multivariate fittings presented. Thefinalsixthchapterisintendedformoreadvancedreadersandexplainsthespecial- ized commands for solving ordinary differential equations (ODEs), spatially one- dimensional partial differential equations (PDEs), and PDE. The modeler interface for two-dimensionalPDEsisbrieflypresentedwithexamplesrelatedtodiffusion,heattrans- fer,andwaveequations.Tounderstandthischapter,afamiliaritywithmathematicsona somewhat higher level is assumed. ® 4 AMATLAB PrimerforTechnicalProgramminginMaterialsScienceandEngineering ® Theappendixpresentsasummarycollectionofapproximately200studiedMATLAB characters, operators,commands, and functions. The index contains more than 700 alphabetically arranged names, terms, and com- mandsthat wereimplemented throughout the book. 1.4 The structure of the chapters Each chapter begins with a general introduction, goals, and chapter content. The new material,maincommandforms,anditsapplicationarethenpresented.Thecommands aretypicallyexplainedinoneortwosimpleformswithpossibleusefulextensionsgiven. Eachtopiciscompletelypresentedinonesectioninordertoallowthereaderstoattainthe knowledgeinafocusedmanner.Tableslistingtheadditionallyavailablecommandsthat correspondtothetopic,commanddescription,andexamplesareincludedinthechapter. Attheendormiddleofthechapter,applicationproblemsassociatedwiththeMSEarea aresolvedwiththecommandsaccessibletothereader.Thegivensolutionsaretheeasiest tounderstandbutnotnecessarilytheshortestororiginal.Readerswouldfinditusefuland areencouragedtotrytheirownsolutionsandcomparetheresultswiththoseinthebook. Forbetterapplication,thequestionsandproblemsforself-testingaregivenattheend ® ofeachchapter;thefirsttenquestionsareMATLAB -oriented,andallotherexercisesare relatedtovariousMSEdisciplines.Irecommendsolvingthemtoattainbetterunderstand- ® ing of MATLAB . At the end of each chapter, the answers to some of the exercises are provided. Itshouldbenotedthatthenumericalvaluesandcontextsusedinthevariousproblems of the book are not factual referencedata and serve foreducational purposes only. 1.5 About MATLAB® versions ® Annually, two new versions of MATLAB appear. Although each version is updated and extended,theyallowworkwithpreviouslywrittencommands.Thus,thebasiccommands described in this book will remain valid in any future versions. The version used in this ® bookisR2018b(9.5.0.944444).ItisexpectedthatreadershaveMATLAB installedontheir computer and will be able to perform all the basic operations presented in the book. 1.6 Order of presentation ® ThebookpresentsaMATLAB primerorientedtoanewcomerincomputercalculations, withthetopicsthenarrangedaccordingly.Nevertheless,ateacherisnotobligatedbythis order.Forexample,the Editor(Section4.1)canbetaught directlyafter theoutput com- mands(Section2.1.7)topermitthesimpleprogramcreationsontheearlylearningstages. Likewise,thematerialregardingcreationofscriptfiles(Section4.1)canbestudiedafter theinputandoutputcommands(Section2.2)toallowstudentstowritescriptprograms

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.