Matlab ebook by rudra pratap singh



Preface 1
1 Introduction 3
1.1 What Is MATLAB? . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Does MATLAB Do SymbolicCalc ulations? . . . . . . . . . . 5
1.3 Will MATLAB Run on My Computer? . . . . . . . . . . . . . 6
1.4 Where Do I Get MATLAB? . . . . . . . . . . . . . . . . . . . 6
1.5 How Do I Use This Book? . . . . . . . . . . . . . . . . . . . . 6
1.6 Basics of MATLAB . . . . . . . . . . . . . . . . . . . . . . . 8
1.6.1 MATLAB windows . . . . . . . . . . . . . . . . . . . . 8
1.6.2 On-line help . . . . . . . . . . . . . . . . . . . . . . . . 9
1.6.3 Input-Output . . . . . . . . . . . . . . . . . . . . . . . 9
1.6.4 File types . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.6.5 Platform dependence . . . . . . . . . . . . . . . . . . . 12
1.6.6 General commands you should remember . . . . . . . 15
1.7 Visit This Again . . . . . . . . . . . . . . . . . . . . . . . . . 16
2 Tutorial Lessons 19
2.1 Lesson 1: A Minimum MATLAB Session . . . . . . . . . . . . 21
2.2 Lesson 2: Working with Arrays of Numbers . . . . . . . . . . 25
2.3 Lesson 3: Creating and Printing Simple Plots . . . . . . . . . 29
2.4 Lesson 4: Creating, Saving, and Executing a Script File . . . 33
2.5 Lesson 5: Creating and Executing a Function File . . . . . . 37
2.6 Lesson 6: Working with Files and Directories . . . . . . . . . 42
3 Interactive Computation 47
3.1 Matrices and Vectors . . . . . . . . . . . . . . . . . . . . . . . 49
3.1.1 Input . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.1.2 Indexing (or Subscripting) . . . . . . . . . . . . . . . . 50
3.1.3 Matrix Manipulation . . . . . . . . . . . . . . . . . . . 52
3.1.4 Creating Vectors . . . . . . . . . . . . . . . . . . . . . 55
3.2 Matrix and Array Operations . . . . . . . . . . . . . . . . . . 57