ebook img

A guide to MATLAB: for beginners and experienced users PDF

329 Pages·2006·2.547 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 guide to MATLAB: for beginners and experienced users

This page intentionally left blank A Guide to M ® ATLAB for Beginners and Experienced Users Second Edition Brian R. Hunt Ronald L. Lipsman Jonathan M. Rosenberg with Kevin R. Coombes John E. Osborn Garrett J. Stuck ® A Guide to M ATLAB for Beginners and Experienced Users Second Edition Updated for MATLAB®7 and Simulink®6 Brian R. Hunt Ronald L. Lipsman Jonathan M. Rosenberg All of the University of Maryland, College Park with Kevin R. Coombes John E. Osborn Garrett J. Stuck cambridge university press Cambridge, New York, Melbourne, Madrid, Cape Town, Singapore, São Paulo Cambridge University Press TheEdinburghBuilding,Cambridgecb22ru,UK Published in the United States of America by Cambridge University Press, New York www.cambridge.org Informationo nthi stitle :www.cambri dge.org/9780521850681 ©B.Hunt,R.Lipsman,J.Rosenberg,K.Coombes,J.Osborn,andG.Stuck2001,2006 Thispublicationisincopyright.Subjecttostatutoryexceptionandtotheprovisionof relevant collective licensing agreements, no reproduction of any part may take place without the written permission of Cambridge University Press. Firstpublishedinprintformat 2006 isbn-13 978-0-511-21985-6 eBook(EBL) isbn-10 0-511-21985-7 eBook(EBL) isbn-13 978-0-521-85068-1 hardback isbn-10 0-521-85068-1 hardback isbn-13 978-0-521-61565-5 paperback isbn-10 0-521-61565-8 paperback Cambridge University Press has no responsibility for the persistence or accuracy ofurls forexternalorthird-partyinternetwebsitesreferredtointhispublication,anddoesnot guaranteethatanycontentonsuchwebsitesis,orwillremain,accurateorappropriate. Contents Thesymbol✰denotesamoreadvancedchapterorsection. Preface page xi WhyWeWroteThisBook xi WhoShouldReadThisBook xii HowThisBookIsOrganized xii ConventionsUsedinThisBook xiv AbouttheAuthors xv 1 GettingStarted 1 PlatformsandVersions 1 Installation 2 StartingMATLAB 2 TypingintheCommandWindow 3 OnlineHelp 3 MATLABWindows 6 EndingaSession 6 2 MATLABBasics 7 InputandOutput 7 Arithmetic 8 RecoveringfromProblems 9 ErrorsinInput 9 AbortingCalculations 9 AlgebraicorSymbolicComputation 10 SubstitutinginSymbolicExpressions 10 Symbolic Expressions, Variable Precision, and Exact Arith- metic 11 VectorsandMatrices 12 Vectors 13 Matrices 14 SuppressingOutput 15 Functions 15 Built-inFunctions 15 User-DefinedFunctions 16 ManagingVariables 17 v vi Contents VariablesandAssignments 18 SolvingEquations 20 Graphics 22 Graphingwithezplot 22 ModifyingGraphs 23 Graphingwithplot 24 PlottingMultipleCurves 25 3 InteractingwithMATLAB 27 TheMATLABInterface 27 TheDesktop 27 TheWorkspace 28 TheCurrentDirectoryandSearchPath 28 TheCommandHistoryWindow 30 M-Files 31 ScriptM-Files 31 FunctionM-Files 33 Loops 35 PresentingYourResults 35 PublishinganM-File 36 DiaryFiles 37 InteractiveM-Files 37 WrappingLongInputandOutputLines 38 PrintingandSavingGraphics 38 M-Books 39 Fine-TuningYourM-Files 41 PracticeSetA:AlgebraandArithmetic 43 4 BeyondtheBasics 45 SuppressingOutput 45 DataClasses 46 StringManipulation 47 SymbolicandFloating-PointNumbers 48 FunctionsandExpressions 48 Substitution 50 MoreaboutM-Files 50 VariablesinScriptM-Files 50 VariablesinFunctionM-Files 50 StructureofFunctionM-Files 51 ComplexArithmetic 51 MoreonMatrices 52 SolvingLinearSystems 53 CalculatingEigenvaluesandEigenvectors 53 DoingCalculuswithMATLAB 54 Contents vii Differentiation 54 Integration 54 Limits 55 SumsandProducts 56 TaylorSeries 57 DefaultVariables 57 5 MATLABGraphics 59 Two-DimensionalPlots 59 ParametricPlots 59 ContourPlotsandImplicitPlots 60 FieldPlots 62 Three-DimensionalPlots 62 CurvesinThree-DimensionalSpace 62 SurfacesinThree-DimensionalSpace 64 FigureWindows 65 MultipleFigureWindows 66 TheFigureToolbar 66 CombiningPlotsinOneWindow 67 ✰ CustomizingGraphics 67 Annotation 69 ChangeofPlotStyle 70 Full-FledgedCustomization 71 ✰ Images,Animations,andSound 73 Images 74 Animations 76 Sound 77 PracticeSetB:Calculus,Graphics,andLinearAlgebra 79 6 MATLABProgramming 85 Branching 85 Branchingwithif 85 LogicalExpressions 87 Branchingwithswitch 91 MoreaboutLoops 92 Open-EndedLoops 92 BreakingfromaLoop 93 OtherProgrammingCommands 94 Subfunctions 94 CellandStructureArrays 94 CommandsforParsingInputandOutput 95 EvaluationandFunctionHandles 97 UserInputandScreenOutput 98 Debugging 100 viii Contents ✰ InteractingwiththeOperatingSystem 100 CallingExternalPrograms 101 FileInputandOutput 102 7 PublishingandM-Books 103 FinePointsofPublishing 103 MoreonM-Books 106 TheNotebookMenuItems 107 M-BookGraphics 108 MoreHintsforEffectiveUseofM-Books 108 8 Simulink 111 ASimpleDifferentialEquation 111 ✰ AnEngineeringExample 115 ✰ CommunicationwiththeWorkspace 120 9 ✰GUIs 123 GUILayoutandGUIDE 123 SavingandRunningaGUI 126 GUICallbackFunctions 127 10 Applications 131 IlluminatingaRoom 132 MortgagePayments 138 MonteCarloSimulation 144 PopulationDynamics 150 LinearEconomicModels 160 LinearProgramming 165 The360◦Pendulum 172 ✰ NumericalSolutionoftheHeatEquation 175 ✰ AModelofTrafficFlow 185 PracticeSetC:DevelopingYourMATLABSkills 195 11 Troubleshooting 205 CommonProblems 205 WrongorUnexpectedOutput 205 SyntaxError 207 SpellingError 209 ErrororWarningMessagesWhenPlotting 209 APreviouslySavedM-FileEvaluatesDifferently 210 ComputerWon’tRespond 211 TheMostCommonMistakes 211 DebuggingTechniques 212

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.