E-Book Content
MATLAB Guide1 Desmond J. Higham and Nicholas J. Higham Version of June 27, 2000 To be published by SIAM in 2000. Not for distribution
1
c D. J. Higham and N. J. Higham, 2000
To our parents
Contents List of Figures List of Tables List of M-Files Preface 1 A Brief Tutorial 2 Basics 2.1 2.2
xi xv xvii xix 1 21
Interaction and Script Files . . . . . . . . . . . . . . . . . . . . . . . . 21 More Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3 Distinctive Features of MATLAB
31
4 Arithmetic
35
3.1 3.2 3.3 4.1 4.2 4.3
Automatic Storage Allocation . . . . . . . . . . . . . . . . . . . . . . 31 Functions with Variable Arguments Lists . . . . . . . . . . . . . . . . 31 Complex Arrays and Arithmetic . . . . . . . . . . . . . . . . . . . . . 32 IEEE Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Mathematical Functions . . . . . . . . . . . . . . . . . . . . . . . . . 38
5 Matrices 5.1 5.2 5.3 5.4 5.5
Matrix Generation . . . . . . . . . . . Subscripting and the Colon Notation Matrix and Array Operations . . . . Matrix Manipulation . . . . . . . . . Data Analysis . . . . . . . . . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
6 Operators and Flow Control 6.1 6.2
39 45 47 50 52
57
Relational and Logical Operators . . . . . . . . . . . . . . . . . . . . 57 Flow Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .