برای استفاده از امکانات سیستم، گزینه جاوا اسکریپت در مرورگر شما باید فعال باشد
صفحه
از
0
Essential MATLAB for engineers and scientists
Hahn, Brian D.
اطلاعات کتابشناختی
Essential MATLAB for engineers and scientists
Author :
Hahn, Brian D.
Publisher :
Elsevier/Academic Press,
Pub. Year :
2010
Subjects :
Numerical analysis -- Data processing.
Call Number :
QA 297 .H24 2010
جستجو در محتوا
ترتيب
شماره صفحه
امتياز صفحه
فهرست مطالب
Contents
(3)
Preface
(14)
ACKNOWLEDGMENTS
(15)
PART 1: Essentials
(16)
1 Introduction
(18)
1.1 USING MATLAB
(20)
1.1.1 Arithmetic
(20)
1.1.2 Variables
(22)
1.1.3 Mathematical functions
(23)
1.1.4 Functions and commands
(24)
1.1.5 Vectors
(24)
1.1.6 Linear equations
(26)
1.1.7 Demo
(27)
1.1.8 Help
(27)
1.1.9 Additional features
(28)
1.2 THE MATLAB DESKTOP
(30)
1.3 SAMPLE PROGRAM
(31)
1.3.1 Cut and paste
(31)
1.3.2 Saving a program: script files
(33)
1.3.3 A program in action
(34)
EXERCISES
(35)
SUMMARY
(36)
CHAPTER EXERCISES
(36)
2 MATLAB Fundamentals
(38)
2.1 VARIABLES
(38)
2.1.1 Case sensitivity
(39)
2.2 THE WORKSPACE
(39)
2.2.1 Adding commonly used constants to the workspace
(40)
2.3 ARRAYS: VECTORS AND MATRICES
(41)
2.3.1 Initializing vectors: Explicit lists
(41)
EXERCISES
(41)
2.3.2 Initializing vectors: The colon operator
(42)
2.3.3 The linspace function
(43)
2.3.4 Transposing vectors
(43)
2.3.5 Subscripts
(43)
2.3.6 Matrices
(44)
2.3.7 Capturing output
(45)
2.4 VERTICAL MOTION UNDER GRAVITY
(45)
2.5 OPERATORS, EXPRESSIONS, AND STATEMENTS
(47)
2.5.1 Numbers
(48)
2.5.2 Data types
(49)
2.5.3 Arithmetic operators
(49)
2.5.4 Operator precedence
(49)
EXERCISES
(50)
2.5.5 The colon operator
(50)
2.5.6 The transpose operator
(51)
2.5.7 Arithmetic operations on arrays
(51)
EXERCISES
(52)
2.5.8 Expressions
(52)
2.5.9 Statements
(53)
2.5.10 Statements, commands, and functions
(54)
2.5.11 Formula vectorization
(54)
EXERCISES
(55)
2.6 OUTPUT
(57)
2.6.1 The disp statement
(57)
2.6.2 The format command
(58)
2.6.3 Scale factors
(60)
2.7 REPEATING WITH for
(60)
2.7.1 Square roots with Newton’s method
(61)
2.7.2 Factorials!
(62)
2.7.3 Limit of a sequence
(62)
2.7.4 The basic for construct
(63)
2.7.5 for in a single line
(65)
2.7.6 More general for
(65)
2.7.7 Avoid for loops by vectorizing!
(65)
EXERCISES
(67)
2.8 DECISIONS
(68)
2.8.1 The one-line if statement
(68)
EXERCISES
(69)
2.8.2 The if-else construct
(70)
2.8.3 The one-line if-else statement
(71)
2.8.4 elseif
(71)
2.8.5 Logical operators
(72)
2.8.6 Multiple ifs versus elseif
(73)
2.8.7 Nested ifs
(74)
2.8.8 Vectorizing ifs?
(75)
2.8.9 The switch statement
(75)
2.9 COMPLEX NUMBERS
(76)
2.10 MORE ON INPUT AND OUTPUT
(78)
2.10.1 fprintf
(78)
2.10.2 Output to a disk file with fprintf
(79)
2.10.3 General file I/O
(80)
2.10.4 Saving and loading data
(80)
2.11 ODDS AND ENDS
(80)
2.11.1 Variables, functions, and scripts with the same name
(80)
2.11.2 The input statement
(81)
EXERCISES
(82)
2.11.3 Shelling out to the operating system
(82)
2.11.4 More Help functions
(82)
2.12 PROGRAMMING STYLE
(82)
SUMMARY
(83)
CHAPTER EXERCISES
(86)
3 Program Design and Algorithm Development
(92)
3.1 THE PROGRAM DESIGN PROCESS
(93)
3.1.1 The projectile problem
(95)
3.2 STRUCTURE PLAN EXAMPLES
(100)
3.2.1 Quadratic equation
(101)
3.3 STRUCTURED PROGRAMMING WITH FUNCTIONS
(103)
SUMMARY
(103)
CHAPTER EXERCISES
(103)
4 MATLAB Functions and Data Import–Export Utilities
(106)
4.1 COMMON FUNCTIONS
(106)
4.2 IMPORTING AND EXPORTING DATA
(111)
4.2.1 The load and save commands
(111)
4.2.2 Exporting text (ASCII) data
(112)
4.2.3 Importing text (ASCII) data
(112)
4.2.4 Exporting and importing binary data
(112)
4.2.5 The Import Wizard
(113)
4.2.6 *Low-level file I/O functions
(113)
4.2.7 *Other import/export functions
(118)
SUMMARY
(118)
CHAPTER EXERCISES
(119)
5 Logical Vectors
(122)
5.1 EXAMPLES
(123)
5.1.1 Discontinuous graphs
(123)
5.1.2 Avoiding division by zero
(124)
5.1.3 Avoiding infinity
(125)
5.1.4 Counting random numbers
(126)
5.1.5 Rolling dice
(127)
5.2 LOGICAL OPERATORS
(128)
5.2.1 Operator precedence
(129)
5.2.2 Incorrect conversion
(130)
5.2.3 Logical operators and vectors
(130)
EXERCISE
(131)
5.3 SUBSCRIPTING WITH LOGICAL VECTORS
(131)
5.4 LOGICAL FUNCTIONS
(132)
5.4.1 Using any and all
(133)
5.5 LOGICAL VECTORS INSTEAD OF elseif
(134)
LADDERS
(134)
SUMMARY
(137)
CHAPTER EXERCISES
(137)
6 Matrices of Numbers and Arrays of Strings
(140)
6.1 MATRICES
(141)
6.1.1 A concrete example
(141)
6.1.2 Creating matrices
(142)
6.1.3 Subscripts
(142)
6.1.4 The transpose operator
(143)
6.1.5 The colon operator
(143)
6.1.6 Duplicating rows and columns: Tiling
(147)
6.1.7 Deleting rows and columns
(147)
6.1.8 Elementary matrices
(148)
6.1.9 Specialized matrices
(149)
6.1.10 Using MATLAB functions with matrices
(150)
6.1.11 Manipulating matrices
(151)
6.1.12 Array (element-by-element) operations on matrices
(151)
6.1.13 Matrices and for
(152)
6.1.14 Visualization of matrices
(152)
6.1.15 Vectorizing nested fors: Loan repayment tables
(152)
6.1.16 Multidimensional arrays
(155)
6.2 MATRIX OPERATIONS
(155)
6.2.1 Multiplication
(155)
6.2.2 Exponentiation
(157)
6.3 OTHER MATRIX FUNCTIONS
(158)
6.4 *STRINGS
(158)
6.4.1 Input
(158)
6.4.2 Strings as arrays
(159)
6.4.3 String concatenation
(159)
6.4.4 ASCII codes: double and char
(159)
6.4.5 String display with fprintf
(161)
6.4.6 Comparing strings
(161)
6.4.7 Other string functions
(161)
6.5 *TWO-DIMENSIONAL STRINGS
(162)
6.6 *eval AND TEXT MACROS
(163)
6.6.1 Error trapping with eval and lasterr
(163)
6.6.2 eval with try...catch
(164)
SUMMARY
(165)
CHAPTER EXERCISES
(165)
7 Introduction to Graphics
(168)
7.1 BASIC TWO-DIMENSIONAL GRAPHS
(168)
EXERCISES
(169)
7.1.1 Labels
(170)
7.1.2 Multiple plots on the same axes
(170)
7.1.3 Line styles, markers, and color
(171)
7.1.4 Axis limits
(171)
7.1.5 Multiple plots in a figure: subplot
(172)
7.1.6 figure, clf, and cla
(174)
7.1.7 Graphical input
(174)
7.1.8 Logarithmic plots
(174)
7.1.9 Polar plots
(175)
7.1.10 Plotting rapidly changing mathematical
(176)
functions: fplot
(176)
7.1.11 The Property Editor
(177)
7.2 THREE-DIMENSIONAL PLOTS
(177)
7.2.1 The plot3 function
(177)
7.2.2 Animated 3D plots with the comet3 function
(178)
7.2.3 Mesh surfaces
(178)
EXERCISES
(180)
7.2.4 Contour plots
(180)
7.2.5 Cropping a surface with NaNs
(182)
7.2.6 Visualizing vector fields
(182)
7.2.7 Matrix visualization
(183)
7.2.8 3D graph rotation
(184)
7.2.9 Other graphics functions
(185)
SUMMARY
(193)
CHAPTER EXERCISES
(194)
8 Loops
(200)
8.1 DETERMINATE REPETITION WITH for
(200)
8.1.1 Binomial coefficient
(200)
8.1.2 Update processes
(201)
8.1.3 Nested fors
(203)
8.2 INDETERMINATE REPETITION WITH while
(203)
8.2.1 A guessing game
(203)
8.2.2 The while statement
(204)
8.2.3 Doubling time of an investment
(205)
8.2.4 Prime numbers
(206)
8.2.5 Projectile trajectory
(207)
8.2.6 break
(209)
8.2.7 Menus
(210)
SUMMARY
(211)
CHAPTER EXERCISES
(212)
9 Errors and Pitfalls
(216)
9.1 SYNTAX ERRORS
(216)
9.1.1 Incompatible vector sizes
(217)
9.1.2 Name hiding
(217)
9.2 LOGIC ERRORS
(217)
9.3 ROUNDING ERROR
(218)
SUMMARY
(219)
CHAPTER EXERCISES
(219)
10 Function M-files
(222)
10.1 INLINE OBJECTS: HARMONIC OSCILLATORS
(222)
10.2 FUNCTION M-FILES: NEWTON’S METHOD REVISITED
(224)
10.3 BASIC RULES
(225)
10.3.1 Subfunctions
(230)
10.3.2 Private functions
(230)
10.3.3 P-code files
(230)
10.3.4 Improving M-file performance with the profiler
(230)
10.4 FUNCTION HANDLES
(231)
10.5 COMMAND/FUNCTION DUALITY
(232)
10.6 FUNCTION NAME RESOLUTION
(233)
10.7 DEBUGGING M-FILES
(234)
10.7.1 Debugging a script
(234)
10.7.2 Debugging a function
(236)
10.8 RECURSION
(236)
SUMMARY
(237)
CHAPTER EXERCISES
(239)
11 Vectors as Arrays and *Advanced Data Structures
(242)
11.1 UPDATE PROCESSES
(242)
11.1.1 Unit time steps
(243)
11.1.2 Non–unit time steps
(245)
11.1.3 Using a function
(246)
11.1.4 Exact solution
(248)
11.2 FREQUENCIES, BAR CHARTS, AND HISTOGRAMS
(248)
11.2.1 A random walk
(248)
11.2.2 Histograms
(250)
11.3 *SORTING
(250)
11.3.1 Bubble Sort
(251)
11.3.2 MATLAB’s sort
(252)
11.4 *STRUCTURES
(253)
11.5 *CELL ARRAYS
(255)
11.5.1 Assigning data to cell arrays
(255)
11.5.2 Accessing data in cell arrays
(257)
11.5.3 Using cell arrays
(257)
11.5.4 Displaying and visualizing cell arrays
(258)
11.6 *CLASSES AND OBJECTS
(259)
SUMMARY
(259)
12 *More Graphics
(260)
12.1 HANDLE GRAPHICS
(260)
12.1.1 Getting handles
(261)
12.1.2 Changing graphics object properties
(262)
12.1.3 A vector of handles
(263)
12.1.4 Graphics object creation functions
(264)
12.1.5 Parenting
(264)
12.1.6 Positioning figures
(265)
12.2 EDITING PLOTS
(266)
12.2.1 Plot edit mode
(266)
12.2.2 Property Editor
(267)
12.3 ANIMATION
(268)
12.3.1 Animation with Handle Graphics
(269)
12.4 COLORMAPS
(271)
12.4.1 Surface plot color
(273)
12.4.2 Truecolor
(274)
12.5 LIGHTING AND CAMERA
(274)
12.6 SAVING, PRINTING, AND EXPORTING GRAPHS
(275)
12.6.1 Saving and opening figure files
(275)
12.6.2 Printing a graph
(275)
12.6.3 Exporting a graph
(276)
SUMMARY
(276)
CHAPTER EXERCISES
(277)
13 *Graphical User Interfaces (GUIs)
(278)
13.1 BASIC STRUCTURE OF A GUI
(278)
13.2 A FIRST EXAMPLE: GETTING THE TIME
(279)
13.3 NEWTON’S METHOD YET AGAIN
(283)
13.4 AXES ON A GUI
(286)
13.5 ADDING COLOR TO A BUTTON
(287)
SUMMARY
(288)
PART 2: Applications
(290)
14 Dynamical Systems
(292)
14.1 CANTILEVER BEAM
(293)
14.2 ELECTRIC CURRENT
(294)
14.3 FREE FALL
(296)
14.4 PROJECTILE WITH FRICTION
(306)
SUMMARY
(309)
CHAPTER EXERCISES
(310)
15 Simulation
(312)
15.1 RANDOM NUMBER GENERATION
(312)
15.1.1 Seeding rand
(313)
15.2 FLIPPING COINS
(313)
15.3 ROLLING DICE
(314)
15.4 BACTERIUM DIVISION
(315)
15.5 A RANDOM WALK
(315)
15.6 TRAFFIC FLOW
(317)
15.7 NORMAL (GAUSSIAN) RANDOM NUMBERS
(320)
SUMMARY
(320)
CHAPTER EXERCISES
(321)
16 *More Matrices
(324)
16.1 LESLIE MATRICES: POPULATION GROWTH
(324)
16.2 MARKOV PROCESSES
(328)
16.2.1 A random walk
(328)
16.3 LINEAR EQUATIONS
(330)
16.3.1 MATLAB’s solution
(331)
16.3.2 The residual
(332)
16.3.3 Overdetermined systems
(332)
16.3.4 Underdetermined systems
(333)
16.3.5 Ill-conditioned systems
(333)
16.3.6 Matrix division
(334)
16.4 SPARSE MATRICES
(335)
SUMMARY
(338)
CHAPTER EXERCISES
(338)
17 *Introduction to Numerical Methods
(340)
17.1 EQUATIONS
(340)
17.1.1 Newton’s method
(340)
17.1.2 The Bisection method
(343)
17.1.3 The fzero and roots functions
(344)
17.2 INTEGRATION
(345)
17.2.1 The Trapezoidal rule
(345)
17.2.2 Simpson’s rule
(346)
17.2.3 The quad function
(347)
17.3 NUMERICAL DIFFERENTIATION
(347)
17.3.1 The diff function
(348)
17.4 FIRST-ORDER DIFFERENTIAL EQUATIONS
(349)
17.4.1 Euler’s method
(349)
17.4.2 Example: Bacteria colony growth
(350)
17.4.3 Alternative subscript notation
(351)
17.4.4 A predictor-corrector method
(353)
17.5 LINEAR ORDINARY DIFFERENTIAL
(354)
EQUATIONS
(354)
17.6 RUNGE-KUTTA METHODS
(354)
17.6.1 A single differential equation
(354)
17.6.2 Systems of differential equations: Chaos
(355)
17.6.3 Passing additional parameters to an ODE solver
(358)
17.7 A PARTIAL DIFFERENTIAL EQUATION
(359)
17.7.1 Heat conduction
(359)
17.8 OTHER NUMERICAL METHODS
(363)
SUMMARY
(364)
CHAPTER EXERCISES
(364)
Appendix A: Syntax: Quick Reference
(368)
A.1 EXPRESSIONS
(368)
A.2 FUNCTION M-FILES
(368)
A.3 GRAPHICS
(368)
A.4 if AND switch
(369)
A.5 for AND while
(370)
A.6 INPUT/OUTPUT
(371)
A.7 load/save
(371)
A.8 VECTORS AND MATRICES
(372)
Appendix B: Operators
(374)
Appendix C: Command and Function: Quick Reference
(376)
C.1 GENERAL-PURPOSE COMMANDS
(376)
C.1.1 Managing variables and the workspace
(376)
C.1.2 Files and the operating system
(376)
C.1.3 Controlling the Command Window
(377)
C.1.4 Starting and quitting MATLAB
(377)
C.2 LOGICAL FUNCTIONS
(377)
C.3 MATLAB PROGRAMMING TOOLS
(377)
C.3.1 Interactive input
(378)
C.4 MATRICES
(378)
C.4.1 Special variables and constants
(378)
C.4.2 Time and date
(378)
C.4.3 Matrix manipulation
(378)
C.4.4 Specialized matrices
(379)
C.5 MATHEMATICAL FUNCTIONS
(379)
C.6 MATRIX FUNCTIONS
(380)
C.7 DATA ANALYSIS
(380)
C.8 POLYNOMIAL FUNCTIONS
(380)
C.9 FUNCTION FUNCTIONS
(381)
C.10 SPARSE MATRIX FUNCTIONS
(381)
C.11 CHARACTER STRING FUNCTIONS
(381)
C.12 FILE I/O FUNCTIONS
(381)
C.13 2D GRAPHICS
(381)
C.14 3D GRAPHICS
(382)
C.15 GENERAL
(382)
Appendix D: ASCII Character Codes
(384)
Appendix E: Solutions to Selected Exercises
(385)
CHAPTER 1
(385)
CHAPTER 2
(385)
CHAPTER 3
(389)
CHAPTER 4
(391)
CHAPTER 5
(391)
CHAPTER 7
(392)
CHAPTER 8
(392)
CHAPTER 9
(394)
CHAPTER 10
(394)
CHAPTER 15
(395)
CHAPTER 16
(396)
CHAPTER 17
(396)
INDEX
(398)