There is a summary of the commands at the beginning of each section This summary is followed by more detailed explanations of the commands, illustrative examples and programs.

Heavy stock paper-useful for making notes-separates the chapters. Page numbering starts again in each chapter. There are further note pages before chapter 1 and at the end of the book.

Many of files that appear in this book can be found at: / ~rhfischl / matlab.html /

Using MATLAB with windows, UNIX, DOS i

Chapter I Running MATLAB

    I. 1 A sample MATLAB session 1

    Basics of MATLAB: starting, quitting, entering matrices, "diaries", lists of variables, clearing, executing system commands while in MATLAB

    I.2 Five special symbols [ ] ( ) ; , : 7

    I.3 Programs, simple loops and functions 12

    1. Creating and importing program and data files
    2. Pauses
    3. "For-loops"
    4. Creating and using your own functions


    I.4 Advanced importing and exporting of data techniques 22

    1. Importing data from a file
    2. Long lines of data
    3. Importing data from the keyboard; using the input function
    4. Saving variables to ".mat" files
    5. Reloading variables from ".mat" files
    6. Saving one variable in ASCII format


    I.5 Formatting the output; tables 28

    1. Using the disp command; tables
    2. The number of decimal places in the output

Chapter II. MATLAB operations

    II.1 Basic MATLAB matrix and pointwise operations 1

    1. Transpose
    2. Addition
    3. Multiplication iv. Powers
    4. Element by element multiplication
    5. Element by element division
    6. Exponential type (pointwise and matrix)


    II.2 Six special matrices 6

    1. dentity matrix
    2. matrix of ones
    3. matrix of zeros
    4. matrix of random elements
    5. row vectors of indices
    6. Empty matrix


    II.3 Common MATLAB functions 13

    1. Linear algebra
    2. Matrix manipulations
    3. Pi, roots, complex numbers, zeros of polynomials
    4. Summing, maximum etc.
    5. Real and imaginary parts etc.
    6. Rounding the answer etc.
    7. Exponential type functions
    8. Trigonometric functions
    9. Timing


    II.4 Extracting and Building Matrices 30

    1. Building matrices from vectors
    2. Extracting rows and columns from matrices
    3. Extracting several rows or columns
    4. Replacing a column or row by a vector
    5. Building matrices from submatrices
    6. Replacing a block of a matrix by a given matrix
    7. Building matrices recursively by assignment and by concatenation; the empty matrix: [ ]
    8. Storing and "fetching" sequences of matrices
    9. Building a diagonal matrix from a vector
    10. Building matrices with many zeros
    11. Forming a vector from the elements of a matrix


    II.5 Matrix column operations (summing etc.) and sorting 44

    Column functions.

    II.6 Graphing vectors and matrices 49

    II.7 Numerical Analysis 68

    1. Defining functions
    2. Finding the roots of a polynomial
    3. Finding the roots of a defined function
    4. Finding the maximum and minimum of a function
    5. Finding the definite integral of a function
    6. Plotting defined functions
    7. Curve Fitting
    8. Estimating Values /Interpolation


    II.8 Logical operators and advanced programming 76

    1. Relational symbols
    2. Logical operators
    3. Conditional loops
    4. Breaking out of a program; error statements
    5. "While loops"
    6. Breaking out of loops
    7. Conditional vectors and matrices
    8. Testing conditions with any and all
    9. Finding indices corresponding to a condition
    10. An illustrative example: four methods

Chapter III. Special Topics

    III.1 Linear equations 1

    1. General systems
    2. An infinite number of parametric solutions
    3. No solutions
    4. Cramer's rule
    5. Inverse
    6. Using the division operator; "LU decompositions"
    7. Large systems of equations
    8. Linear independence


    III.2 Eigenvalues and eigenvectors 14

    1. Right eigenvectors and eigenvalues
    2. Left eigenvectors and eigenvalues
    3. Spectral decompositions


    III.3 Matrix power models 22

Editorial Conventions


Web Site Training provided by Kathryn Charis Apunen Washburn summer 2001