Preface |
|
xvii | |
|
|
xxiii | |
|
|
1 | (58) |
|
1.1 The MATLAB Development Environment |
|
|
2 | (2) |
|
|
3 | (1) |
|
|
4 | (1) |
|
|
4 | (6) |
|
1.2.1 Command Window Calculator |
|
|
4 | (2) |
|
|
6 | (1) |
|
|
6 | (1) |
|
|
7 | (1) |
|
|
8 | (1) |
|
|
9 | (1) |
|
1.2.7 Some Pre-defined Constants |
|
|
9 | (1) |
|
|
10 | (2) |
|
|
11 | (1) |
|
|
11 | (1) |
|
|
12 | (1) |
|
|
12 | (3) |
|
|
12 | (1) |
|
|
13 | (1) |
|
|
13 | (1) |
|
|
14 | (1) |
|
|
15 | (4) |
|
|
15 | (1) |
|
|
15 | (1) |
|
|
16 | (1) |
|
1.5.4 Application of For Loops in MATLAB |
|
|
17 | (1) |
|
|
17 | (1) |
|
|
18 | (1) |
|
|
19 | (1) |
|
|
19 | (8) |
|
1.6.1 Selection Statements |
|
|
21 | (1) |
|
|
21 | (1) |
|
|
21 | (1) |
|
|
22 | (1) |
|
1.6.1.4 Switch--Case Construct |
|
|
22 | (1) |
|
1.6.1.5 Example Selection Statements |
|
|
23 | (1) |
|
|
23 | (1) |
|
1.6.3 Example Control Constructs---sine |
|
|
24 | (1) |
|
|
24 | (1) |
|
|
25 | (1) |
|
|
26 | (1) |
|
1.6.4.3 Continue and Break Example |
|
|
26 | (1) |
|
1.7 Vectors and Matrices in MATLAB |
|
|
27 | (9) |
|
1.7.1 Matrix Generating Functions |
|
|
30 | (1) |
|
1.7.2 Scalar---Vector Arithmetic |
|
|
31 | (1) |
|
1.7.3 Element-wise Arithmetic |
|
|
32 | (1) |
|
1.7.4 Vector and Matrix Indices |
|
|
32 | (1) |
|
1.7.4.1 Ranges of Indices |
|
|
33 | (1) |
|
1.7.4.2 Accessing Data in Matrices |
|
|
33 | (1) |
|
1.7.5 Delete Vector or Matrix Data |
|
|
34 | (1) |
|
1.7.6 Linear and Logarithmic Spaced Vectors |
|
|
35 | (1) |
|
|
36 | (4) |
|
1.8.1 Syntax of a Function |
|
|
36 | (1) |
|
1.8.2 Calling a Function? |
|
|
37 | (1) |
|
|
38 | (1) |
|
|
39 | (1) |
|
1.9 Functions Operating on Vectors |
|
|
40 | (4) |
|
1.9.1 Replacing Loops with Vectorized Code |
|
|
40 | (1) |
|
1.9.2 Vectors as Input Variables |
|
|
40 | (1) |
|
|
40 | (3) |
|
|
43 | (1) |
|
1.10 Importing Data Into MATLAB |
|
|
44 | (5) |
|
1.10.1 Saving and Loading Workspace Data |
|
|
44 | (1) |
|
|
44 | (1) |
|
|
45 | (1) |
|
1.10.4 Dealing with Missing Data |
|
|
45 | (4) |
|
1.10.5 Exporting Table Data |
|
|
49 | (1) |
|
1.11 Text Strings in MATLAB |
|
|
49 | (1) |
|
|
50 | (9) |
|
2 Graphical Data Analysis |
|
|
59 | (22) |
|
|
59 | (2) |
|
|
61 | (10) |
|
2.2.1 Basic Plotting Notes |
|
|
61 | (2) |
|
|
63 | (1) |
|
2.2.3 Starting a New Plot |
|
|
63 | (1) |
|
2.2.4 Multiple Plots in the Same Figure |
|
|
64 | (1) |
|
2.2.5 Multiple Plots on the Same Axis |
|
|
65 | (2) |
|
2.2.6 Adding a Plot Legend |
|
|
67 | (1) |
|
|
68 | (2) |
|
|
70 | (1) |
|
2.2.9 Tick Marks and Labels |
|
|
70 | (1) |
|
|
71 | (1) |
|
|
71 | (5) |
|
|
73 | (2) |
|
|
75 | (1) |
|
|
76 | (5) |
|
3 Statistical Data Analysis |
|
|
81 | (38) |
|
3.1 Introduction to Statistics |
|
|
81 | (1) |
|
3.2 Common Statistical Functions |
|
|
82 | (4) |
|
3.2.1 Minimum and Maximum |
|
|
82 | (1) |
|
3.2.2 Mean, Standard Deviation, Median, and Mode |
|
|
82 | (3) |
|
3.2.3 Sort, Sum, Cumsum, and Diff |
|
|
85 | (1) |
|
3.3 Moving Window Statistics |
|
|
86 | (2) |
|
3.4 Probability Distributions |
|
|
88 | (9) |
|
3.4.1 Discrete Distributions |
|
|
88 | (4) |
|
3.4.2 Continuous Distributions |
|
|
92 | (5) |
|
3.5 Generating Random Numbers |
|
|
97 | (6) |
|
3.5.1 Exponential Random Number Generator |
|
|
99 | (1) |
|
3.5.2 Monte Carlo Simulation |
|
|
100 | (1) |
|
|
101 | (2) |
|
3.6 Statistics on Matrices |
|
|
103 | (3) |
|
|
103 | (1) |
|
|
103 | (1) |
|
3.6.3 Covariance and Correlation |
|
|
104 | (2) |
|
3.7 Plots of Statistical Data |
|
|
106 | (1) |
|
|
106 | (1) |
|
|
107 | (1) |
|
3.8 Central Limit Theorem |
|
|
107 | (1) |
|
3.9 Sampling and Confidence Intervals |
|
|
108 | (2) |
|
3.10 Statistical Significance |
|
|
110 | (6) |
|
|
113 | (1) |
|
|
114 | (2) |
|
|
116 | (3) |
|
4 Using the Symbolic Math Toolbox |
|
|
119 | (14) |
|
|
119 | (3) |
|
|
122 | (4) |
|
|
122 | (1) |
|
|
122 | (1) |
|
|
123 | (1) |
|
|
123 | (1) |
|
|
124 | (1) |
|
|
125 | (1) |
|
|
125 | (1) |
|
|
126 | (2) |
|
4.3.1 Symbolic Derivatives |
|
|
126 | (1) |
|
4.3.2 Symbolic Integration |
|
|
126 | (1) |
|
|
127 | (1) |
|
4.4 Symbolic Differential Equations |
|
|
128 | (2) |
|
|
130 | (3) |
|
5 Introduction to Linear Algebra |
|
|
133 | (110) |
|
|
134 | (10) |
|
|
135 | (1) |
|
5.1.2 Independent Vectors |
|
|
135 | (1) |
|
|
136 | (1) |
|
5.1.4 Dot Product and Inner Product |
|
|
137 | (1) |
|
5.1.5 Dot Product Properties |
|
|
138 | (1) |
|
|
138 | (1) |
|
5.1.5.2 Length of Vectors |
|
|
138 | (1) |
|
5.1.5.3 Angle Between Vectors |
|
|
138 | (1) |
|
5.1.5.4 Orthogonal Vector Test |
|
|
139 | (1) |
|
5.1.6 Application of Dot Products |
|
|
140 | (1) |
|
5.1.6.1 Perpendicular Rhombus Vectors |
|
|
140 | (1) |
|
5.1.6.2 Find a Perpendicular Vector |
|
|
141 | (1) |
|
|
142 | (1) |
|
5.1.8 Dimension and Space |
|
|
143 | (1) |
|
5.2 Working with Matrices |
|
|
144 | (16) |
|
|
145 | (1) |
|
5.2.1.1 Addition and Subtraction |
|
|
145 | (1) |
|
5.2.1.2 Matrix Multiplication |
|
|
145 | (2) |
|
5.2.1.3 Matrix Multiplication Properties |
|
|
147 | (1) |
|
|
148 | (1) |
|
|
149 | (2) |
|
5.2.3 Special Matrix Relationships |
|
|
151 | (1) |
|
|
151 | (1) |
|
5.2.3.2 Matrix Transpose Properties |
|
|
152 | (1) |
|
|
153 | (3) |
|
5.2.5 Calculating a Matrix Inverse |
|
|
156 | (1) |
|
|
157 | (1) |
|
|
158 | (2) |
|
|
160 | (9) |
|
5.3.1 Rotation of a Point |
|
|
160 | (2) |
|
|
162 | (1) |
|
5.3.3 Applying Transformations to a Point |
|
|
163 | (2) |
|
5.3.4 Coordinate Transformations in 2-D |
|
|
165 | (4) |
|
5.4 Systems of Linear Equations |
|
|
169 | (9) |
|
|
169 | (1) |
|
5.4.2 Jumping Ahead to MATLAB |
|
|
170 | (1) |
|
5.4.3 The Column and Row Factorization |
|
|
170 | (3) |
|
5.4.4 The Row and Column View |
|
|
173 | (1) |
|
5.4.5 When Does a Solution Exist? |
|
|
174 | (4) |
|
|
178 | (10) |
|
5.5.1 The Gaussian Elimination Procedure |
|
|
178 | (2) |
|
5.5.2 Elimination to Find the Matrix Inverse |
|
|
180 | (1) |
|
5.5.3 Reduced Row Echelon Form |
|
|
181 | (1) |
|
5.5.4 Accuracy of Elimination |
|
|
182 | (1) |
|
5.5.4.1 The Need for Partial Pivoting |
|
|
183 | (3) |
|
5.5.4.2 RREF and Round-off Errors |
|
|
186 | (1) |
|
5.5.4.3 Poorly Conditioned Matrices |
|
|
186 | (2) |
|
|
188 | (8) |
|
|
189 | (3) |
|
5.6.2 Example with Row Exchanges |
|
|
192 | (1) |
|
5.6.3 MATLAB Examples of LU |
|
|
193 | (1) |
|
5.6.4 LU's Variant Elimination Algorithm |
|
|
194 | (1) |
|
5.6.5 Determinant Shortcut |
|
|
194 | (2) |
|
5.7 Linear System Applications |
|
|
196 | (6) |
|
5.7.1 DC Electric Circuit |
|
|
196 | (1) |
|
|
197 | (1) |
|
|
197 | (1) |
|
|
198 | (1) |
|
5.7.2 The Statics of Trusses |
|
|
199 | (3) |
|
5.8 Under-determined Systems |
|
|
202 | (5) |
|
5.8.1 RREF and Under-determined Systems |
|
|
202 | (3) |
|
5.8.2 The Preferred Under-determined Solution |
|
|
205 | (2) |
|
5.9 Over-determined "Systems and Vector Projections |
|
|
207 | (11) |
|
5.9.1 Projections Onto a Line |
|
|
208 | (2) |
|
5.9.2 Exact Solution or Approximation |
|
|
210 | (1) |
|
5.9.3 Projections Onto a Ffyperplane |
|
|
211 | (2) |
|
5.9.3.1 Projection Example |
|
|
213 | (1) |
|
5.9.3.2 Alternate Projection Equation |
|
|
213 | (3) |
|
5.9.3.3 Higher Dimension Projection |
|
|
216 | (1) |
|
5.9.4 A Statics Problem Solved With Projections |
|
|
217 | (1) |
|
5.10 Least Squares Regression |
|
|
218 | (9) |
|
|
219 | (1) |
|
5.10.1.1 Linear Algebra Based Linear Regression |
|
|
220 | (1) |
|
5.10.1.2 Calculus Based Linear Regression |
|
|
220 | (1) |
|
5.10.1.3 Statistical Linear Regression |
|
|
221 | (1) |
|
5.10.1.4 Linear Regression Example |
|
|
221 | (1) |
|
5.10.2 Quadratic and Higher Order Regression |
|
|
222 | (1) |
|
|
223 | (1) |
|
|
224 | (1) |
|
5.10.5 Generalized Least Squares Regression |
|
|
224 | (1) |
|
5.10.6 Fitting Exponential Data |
|
|
225 | (2) |
|
5.11 Left-Divide Operator |
|
|
227 | (8) |
|
5.11.1 Left-Divide of Critically-determined Systems |
|
|
229 | (1) |
|
5.11.2 Left-Divide of Over-determined Systems |
|
|
230 | (1) |
|
5.11.3 Left-Divide of Under-determined Systems |
|
|
231 | (4) |
|
|
235 | (8) |
|
6 Application of Eigenvalues and Eigenvectors |
|
|
243 | (66) |
|
6.1 Introduction to Eigenvalues and Eigenvectors |
|
|
243 | (2) |
|
6.2 Eigenvector Animation |
|
|
245 | (1) |
|
6.3 Finding Eigenvalues and Eigenvectors |
|
|
246 | (7) |
|
6.3.1 Finding Eigenvalues |
|
|
246 | (3) |
|
6.3.2 Roots of a Polynomial by Eigenvalues |
|
|
249 | (2) |
|
6.3.3 Finding Eigenvectors |
|
|
251 | (2) |
|
6.4 Properties of Eigenvalues and Eigenvectors |
|
|
253 | (1) |
|
6.5 Diagonalization and Powers of A |
|
|
254 | (4) |
|
|
255 | (1) |
|
6.5.1.1 When does Diagonalization not work? |
|
|
255 | (1) |
|
6.5.1.2 Diagonalization of a Symmetric Matrix |
|
|
256 | (1) |
|
|
256 | (2) |
|
6.6 Change of Basis and Difference Equations |
|
|
258 | (10) |
|
6.6.1 Difference Equations |
|
|
260 | (1) |
|
6.6.2 Application: Fibonacci Sequence |
|
|
261 | (2) |
|
6.6.3 Application: Markov Matrices |
|
|
263 | (5) |
|
6.7 Systems of Linear ODEs |
|
|
268 | (7) |
|
|
270 | (1) |
|
6.7.2 Application: Closed Loop Control Systems |
|
|
271 | (4) |
|
6.8 Singular Value Decomposition (SVD) |
|
|
275 | (20) |
|
6.8.1 The Geometry of the SVD |
|
|
275 | (1) |
|
6.8.2 Finding the Classic SVD |
|
|
276 | (2) |
|
6.8.2.1 Ordering the Columns of the SVD |
|
|
278 | (1) |
|
6.8.2.2 SVD of Square Matrices |
|
|
279 | (1) |
|
6.8.2.3 SVD of Rectangular Matrices |
|
|
279 | (2) |
|
6.8.2.4 Classic Implementation |
|
|
281 | (1) |
|
6.8.2.5 SVD Example: Square, full rank |
|
|
281 | (1) |
|
6.8.2.6 SVD Example: Square, singular |
|
|
282 | (1) |
|
6.8.2.7 SVD Example: Rectangular |
|
|
282 | (1) |
|
6.8.3 How SVD Changes Vectors |
|
|
283 | (1) |
|
6.8.4 Dimensionality Reduction |
|
|
283 | (2) |
|
6.8.5 Other Applications of the SVD |
|
|
285 | (1) |
|
|
285 | (4) |
|
6.8.5.2 Projection and the Economy SVD |
|
|
289 | (2) |
|
6.8.5.3 Rank from the SVD |
|
|
291 | (1) |
|
6.8.5.4 Fundamental Subspaces from the SVD |
|
|
292 | (1) |
|
|
293 | (1) |
|
6.8.5.6 Polar Decomposition |
|
|
294 | (1) |
|
6.9 Principal Component Analysis (PCA) |
|
|
295 | (7) |
|
6.9.1 PCA for Data Analysis |
|
|
297 | (1) |
|
6.9.2 PCA for Classification |
|
|
298 | (1) |
|
6.9.3 PCA for Recognition |
|
|
299 | (3) |
|
6.10 Eigenvector Animation Code |
|
|
302 | (1) |
|
|
303 | (6) |
|
7 Computational Numerical Methods |
|
|
309 | (52) |
|
|
309 | (12) |
|
7.1.1 Numerical Roots of a Function |
|
|
310 | (1) |
|
7.1.1.1 Newton-Raphson Method |
|
|
310 | (2) |
|
|
312 | (1) |
|
|
313 | (2) |
|
|
315 | (1) |
|
|
316 | (1) |
|
|
317 | (1) |
|
|
317 | (2) |
|
7.1.3 CVX for Disciplined Convex Programming |
|
|
319 | (2) |
|
|
321 | (3) |
|
7.2.1 One-Dimensional Interpolation |
|
|
321 | (2) |
|
7.2.2 Two-Dimensional Interpolation |
|
|
323 | (1) |
|
7.3 Numerical Differentiation |
|
|
324 | (4) |
|
|
325 | (1) |
|
7.3.2 Spectral Derivative |
|
|
325 | (3) |
|
7.4 Numerical Integration |
|
|
328 | (9) |
|
7.4.1 MATLAB's Integral Function |
|
|
329 | (1) |
|
7.4.2 Fixed Width Subinterval Algorithms |
|
|
330 | (1) |
|
7.4.2.1 Trapezoid Rule Integrals |
|
|
330 | (3) |
|
7.4.2.2 Simpson's Rule Integrals |
|
|
333 | (3) |
|
7.4.3 Recursive Adaptive Integral |
|
|
336 | (1) |
|
7.5 Numerical Differential Equations |
|
|
337 | (21) |
|
|
339 | (2) |
|
|
341 | (1) |
|
|
341 | (1) |
|
7.5.4 Algorithm Comparison |
|
|
342 | (2) |
|
7.5.5 Stability Constraints |
|
|
344 | (1) |
|
7.5.6 Implicit Backward Euler Method |
|
|
345 | (1) |
|
7.5.7 Adaptive Algorithms |
|
|
345 | (1) |
|
|
346 | (2) |
|
|
348 | (1) |
|
7.5.8 The Logistic Equation |
|
|
349 | (1) |
|
|
349 | (2) |
|
7.5.9.1 Stiff ODE Systems |
|
|
351 | (1) |
|
7.5.9.2 Implicit Solvers for Systems of ODEs |
|
|
352 | (3) |
|
|
355 | (1) |
|
7.5.10 MATLAB's Suite of ODE Solvers |
|
|
355 | (3) |
|
|
358 | (3) |
|
A Linear Algebra Appendix |
|
|
361 | (32) |
|
|
361 | (7) |
|
|
362 | (2) |
|
|
364 | (1) |
|
|
364 | (4) |
|
|
368 | (3) |
|
A.2.1 Vector Space Definitions |
|
|
368 | (1) |
|
A.2.2 Linearly Independent Vectors |
|
|
369 | (2) |
|
|
371 | (1) |
|
A.3 Fundamental Matrix Subspaces |
|
|
371 | (7) |
|
|
372 | (1) |
|
|
373 | (3) |
|
|
376 | (1) |
|
|
377 | (1) |
|
A.3.5 Orthogonality of Spaces |
|
|
377 | (1) |
|
A.4 Finding Orthogonal Basis Vectors |
|
|
378 | (2) |
|
A.4.1 The Gram--Schmidt Algorithm |
|
|
379 | (1) |
|
A.4.2 Implementation of Classic Gram--Schmidt |
|
|
380 | (1) |
|
A.4.3 Implementation of Modified Gram--Schmidt |
|
|
380 | (1) |
|
|
380 | (5) |
|
A.5.1 Householder Reflection Matrices |
|
|
383 | (1) |
|
A.5.2 Implementation of QR Factorization |
|
|
384 | (1) |
|
|
385 | (1) |
|
A.7 QR Eigenvalue Computation Algorithm |
|
|
386 | (3) |
|
A.7.1 Iterative QR Algorithm |
|
|
386 | (2) |
|
A.7.2 Similar Matrices in QR |
|
|
388 | (1) |
|
A.8 Linearly Independent Eigenvectors |
|
|
389 | (1) |
|
A.8.1 Pairwise Independence |
|
|
389 | (1) |
|
A.8.2 General Independence |
|
|
389 | (1) |
|
A.9 Symmetric Matrix Eigenvalues and Eigenvectors |
|
|
390 | (3) |
|
A.9.1 Proof of Real Eigenvalues and Eigenvectors |
|
|
390 | (1) |
|
A.9.2 Proof of Orthogonal Eigenvectors |
|
|
391 | (2) |
|
|
393 | (10) |
|
B.1 All About the Number e |
|
|
393 | (6) |
|
B.1.1 Definition and Derivative |
|
|
393 | (3) |
|
B.1.2 Euler's Complex Exponential Equation |
|
|
396 | (1) |
|
B.1.3 Numerical Verification of Euler's Formula |
|
|
397 | (1) |
|
|
398 | (1) |
|
B.2 A Matrix Exponent and Systems of ODEs |
|
|
399 | (4) |
|
B.2.1 A Matrix in the Exponent |
|
|
399 | (2) |
|
B.2.2 Example Matrix Exponent |
|
|
401 | (1) |
|
B.2.3 Matrix Solution to a System of ODEs |
|
|
401 | (1) |
|
B.2.4 Example ODE Matrix Solution |
|
|
402 | (1) |
Bibliography |
|
403 | (6) |
Index |
|
409 | |