Essential MATLAB for Engineers and Scientists, 3rd Edition

Book description

Essential MATLAB for Engineers and Scientists, Third Edition, is an essential guide to MATLAB as a problem-solving tool. It presents MATLAB both as a mathematical tool and a programming language, giving a concise and easy-to-master introduction to its potential and power.

Stressing the importance of a structured approach to problem solving, the text provides a step-by-step method for program design and algorithm development. It includes numerous simple exercises for hands-on learning, a chapter on algorithm development and program design, and a concise introduction to useful topics for solving problems in later engineering and science courses: vectors as arrays, arrays of characters, GUIs, advanced graphics, and simulation and numerical methods.

The text is ideal for undergraduates in engineering and science taking a course on Matlab.

  • Numerous simple exercises give hands-on learning
  • A chapter on algorithm development and program design
  • Common errors and pitfalls highlighted
  • Concise introduction to useful topics for solving problems in later engineering and science courses: vectors as arrays, arrays of characters, GUIs, advanced graphics, simulation and numerical methods
  • A new chapter on dynamical systems shows how a structured approach is used to solve more complex problems.
  • Text and graphics in four colour

Table of contents

  1. Cover
  2. Copyright Page
  3. Contents (1/3)
  4. Contents (2/3)
  5. Contents (3/3)
  6. Preface to the third edition
  7. PART I: ESSENTIALS
    1. Chapter 1 Introduction
      1. 1.1 Using MATLAB (1/3)
      2. 1.1 Using MATLAB (2/3)
      3. 1.1 Using MATLAB (3/3)
      4. 1.2 The MATLAB desktop
      5. 1.3 Sample program (1/2)
      6. 1.3 Sample program (2/2)
        1. 1.3.1 Cut and paste
        2. 1.3.2 Saving a program: script files
        3. 1.3.3 How a program works
    2. Chapter 2 MATLAB fundamentals
      1. 2.1 Variables and the workspace
        1. 2.1.1 Variables
        2. 2.1.2 Case sensitivity
        3. 2.1.3 The workspace
        4. 2.1.4 Adding commonly used constants to the workspace
      2. 2.2 Arrays: vectors and matrices (1/2)
      3. 2.2 Arrays: vectors and matrices (2/2)
        1. 2.2.1 Initializing vectors: explicit lists
        2. 2.2.2 Initializing vectors: the colon operator
        3. 2.2.3 linspace
        4. 2.2.4 Transposing vectors
        5. 2.2.5 Subscripts
        6. 2.2.6 Matrices
        7. 2.2.7 Capturing output
      4. 2.3 Vertical motion under gravity
      5. 2.4 Operators, expressions and statements (1/3)
      6. 2.4 Operators, expressions and statements (2/3)
      7. 2.4 Operators, expressions and statements (3/3)
        1. 2.4.1 Numbers
        2. 2.4.2 Data types
        3. 2.4.3 Arithmetic operators
        4. 2.4.4 Precedence of operators
        5. 2.4.5 The colon operator
        6. 2.4.6 The transpose operator
        7. 2.4.7 Arithmetic operations on arrays
        8. 2.4.8 Expressions
        9. 2.4.9 Statements
        10. 2.4.10 Statements, commands and functions
        11. 2.4.11 Vectorization of formulae
      8. 2.5 Output
        1. 2.5.1 disp
        2. 2.5.2 format
        3. 2.5.3 Scale factors
      9. 2.6 Repeating with for (1/2)
      10. 2.6 Repeating with for (2/2)
        1. 2.6.1 Square roots with Newton's method
        2. 2.6.2 Factorials!
        3. 2.6.3 Limit of a sequence
        4. 2.6.4 The basic for construct
        5. 2.6.5 for in a single line
        6. 2.6.6 More general for
        7. 2.6.7 Avoid for loops by vectorizing!
        8. 2.6.8 A common mistake: for less loops!
      11. 2.7 Decisions (1/2)
      12. 2.7 Decisions (2/2)
        1. 2.7.1 The one-line if statement
        2. 2.7.2 The if-else construct
        3. 2.7.3 The one-line if-else statement
        4. 2.7.4 elseif
        5. 2.7.5 Logical operators
        6. 2.7.6 Multiple ifs versus elseif
        7. 2.7.7 Nested ifs
        8. 2.7.8 Vectorizing ifs?
        9. 2.7.9 switch
      13. 2.8 Complex numbers
      14. 2.9 More on input and output
        1. 2.9.1 fprintf
        2. 2.9.2 Output to a disk file with fprintf
        3. 2.9.3 General file I/O
        4. 2.9.4 Saving and loading data
      15. 2.10 Odds 'n ends
        1. 2.10.1 Variables, functions and scripts with the same name
        2. 2.10.2 The input statement
        3. 2.10.3 Shelling out to the operating system
        4. 2.10.4 More Help functions
      16. 2.11 Programming style (1/2)
      17. 2.11 Programming style (2/2)
    3. Chapter 3 Program design and algorithm development
      1. 3.1 Computer program design process (1/3)
      2. 3.1 Computer program design process (2/3)
      3. 3.1 Computer program design process (3/3)
        1. 3.1.1 Projectile problem example
      4. 3.2 Other examples of structure plans
        1. 3.2.1 Quadratic equation
      5. 3.3 Structured programming with functions
    4. Chapter 4 MATLAB functions & *data import-export utilities
      1. 4.1 Some common functions
      2. 4.2 *Importing and exporting data (1/3)
      3. 4.2 *Importing and exporting data (2/3)
      4. 4.2 *Importing and exporting data (3/3)
        1. 4.2.1 The load and save commands
        2. 4.2.2 Exporting text (ASCII) data
        3. 4.2.3 Importing text (ASCII) data
        4. 4.2.4 Exporting binary data
        5. 4.2.5 The Import Wizard
        6. 4.2.6 Low-level file I/O functions
        7. 4.2.7 Other import/export functions
    5. Chapter 5 Logical vectors
      1. 5.1 Examples
        1. 5.1.1 Discontinuous graphs
        2. 5.1.2 Avoiding division by zero
        3. 5.1.3 Avoiding infinity
        4. 5.1.4 Counting random numbers
        5. 5.1.5 Rolling dice
      2. 5.2 Logical operators
        1. 5.2.1 Operator precedence
        2. 5.2.2 Danger
        3. 5.2.3 Logical operators and vectors
      3. 5.3 Subscripting with logical vectors
      4. 5.4 Logical functions
        1. 5.4.1 Using any and all
      5. 5.5 Logical vectors instead of elseif ladders (1/2)
      6. 5.5 Logical vectors instead of elseif ladders (2/2)
    6. Chapter 6 Matrices of numbers & arrays of strings
      1. 6.1 Matrices (1/3)
      2. 6.1 Matrices (2/3)
      3. 6.1 Matrices (3/3)
        1. 6.1.1 A concrete example
        2. 6.1.2 Creating matrices
        3. 6.1.3 Subscripts
        4. 6.1.4 Transpose
        5. 6.1.5 The colon operator
        6. 6.1.6 Duplicating rows and columns: tiling
        7. 6.1.7 Deleting rows and columns
        8. 6.1.8 Elementary matrices
        9. 6.1.9 *Specialized matrices
        10. 6.1.10 Using MATLAB functions with matrices
        11. 6.1.11 Manipulating matrices
        12. 6.1.12 Array (element-by-element) operations on matrices
        13. 6.1.13 Matrices and for
        14. 6.1.14 Visualization of matrices
        15. 6.1.15 Vectorizing nested fors: loan repayment tables
        16. 6.1.16 Multidimensional arrays
      4. 6.2 Matrix operations
        1. 6.2.1 Matrix multiplication
        2. 6.2.2 Matrix exponentiation
      5. 6.3 Other matrix functions
      6. 6.4 *Strings
        1. 6.4.1 Assignment
        2. 6.4.2 Input
        3. 6.4.3 Strings are arrays
        4. 6.4.4 Concatenation of strings
        5. 6.4.5 ASCII codes, double and char
        6. 6.4.6 fprintf of strings
        7. 6.4.7 Comparing strings
        8. 6.4.8 Other string functions
      7. 6.5 *Two-dimensional strings
      8. 6.6 *eval and text macros (1/2)
      9. 6.6 *eval and text macros (2/2)
        1. 6.6.1 Error trapping with eval and lasterr
        2. 6.6.2 eval with tryƒcatch
    7. Chapter 7 Introduction to graphics
      1. 7.1 Basic 2-D graphs
        1. 7.1.1 Labels
        2. 7.1.2 Multiple plots on the same axes
        3. 7.1.3 Line styles, markers and color
        4. 7.1.4 Axis limits
        5. 7.1.5 Multiple plots in a figure: subplot
        6. 7.1.6 figure, clf and cla
        7. 7.1.7 Graphical input
        8. 7.1.8 Logarithmic plots
        9. 7.1.9 Polar plots
        10. 7.1.10 Plotting rapidly changing mathematical functions: fplot
        11. 7.1.11 The property editor
      2. 7.2 3-D plots (1/5)
      3. 7.2 3-D plots (2/5)
      4. 7.2 3-D plots (3/5)
      5. 7.2 3-D plots (4/5)
      6. 7.2 3-D plots (5/5)
        1. 7.2.1 plot3
        2. 7.2.2 Animated 3-D plots with comet3
        3. 7.2.3 Mesh surfaces
        4. 7.2.4 Contour plots
        5. 7.2.5 Cropping a surface with NaNs
        6. 7.2.6 Visualizing vector fields
        7. 7.2.7 Visualization of matrices
        8. 7.2.8 Rotation of 3-D graphs
        9. 7.2.9 Other cool graphics functions
    8. Chapter 8 Loops
      1. 8.1 Determinate repetition with for
        1. 8.1.1 Binomial coefficient
        2. 8.1.2 Update processes
        3. 8.1.3 Nested fors
      2. 8.2 Indeterminate repetition with while (1/3)
      3. 8.2 Indeterminate repetition with while (2/3)
      4. 8.2 Indeterminate repetition with while (3/3)
        1. 8.2.1 A guessing game
        2. 8.2.2 The while statement
        3. 8.2.3 Doubling time of an investment
        4. 8.2.4 Prime numbers
        5. 8.2.5 Projectile trajectory
        6. 8.2.6 break and continue
        7. 8.2.7 Menus
    9. Chapter 9 Errors and pitfalls
      1. 9.1 Syntax errors
        1. 9.1.1 lasterr
      2. 9.2 Pitfalls and surprises
        1. 9.2.1 Incompatible vector sizes
        2. 9.2.2 Name hiding
        3. 9.2.3 Other pitfalls for the unwary
      3. 9.3 Errors in logic
      4. 9.4 Rounding error
      5. 9.5 Trapping and generating errors
    10. Chapter 10 Function M-files
      1. 10.1 Some examples
        1. 10.1.1 Inline objects: harmonic oscillators
        2. 10.1.2 Function M-files: Newton's method again
      2. 10.2 Basic rules (1/2)
      3. 10.2 Basic rules (2/2)
        1. 10.2.1 Subfunctions
        2. 10.2.2 Private functions
        3. 10.2.3 P-code files
        4. 10.2.4 Improving M-file performance with the profiler
      4. 10.3 Function handles
      5. 10.4 Command/function duality
      6. 10.5 Function name resolution
      7. 10.6 Debugging M-files
        1. 10.6.1 Debugging a script
        2. 10.6.2 Debugging a function
      8. 10.7 Recursion
    11. Chapter 11 Vectors as arrays & *advanced data structures
      1. 11.1 Update processes
        1. 11.1.1 Unit time steps
        2. 11.1.2 Non-unit time steps
        3. 11.1.3 Using a function
        4. 11.1.4 Exact solution
      2. 11.2 Frequencies, bar charts and histograms
        1. 11.2.1 A random walk
        2. 11.2.2 Histograms
      3. 11.3 *Sorting
        1. 11.3.1 Bubble Sort
        2. 11.3.2 MATLAB's sort
      4. 11.4 *Structures
      5. 11.5 *Cell arrays
        1. 11.5.1 Assigning data to cell arrays
        2. 11.5.2 Accessing data in cell arrays
        3. 11.5.3 Using cell arrays
        4. 11.5.4 Displaying and visualizing cell arrays
      6. 11.6 *Classes and objects
    12. Chapter 12 *More graphics
      1. 12.1 Handle Graphics
        1. 12.1.1 Getting handles
        2. 12.1.2 Graphics object properties and how to change them
        3. 12.1.3 A vector of handles
        4. 12.1.4 Graphics object creation functions
        5. 12.1.5 Parenting
        6. 12.1.6 Positioning figures
      2. 12.2 Editing plots
        1. 12.2.1 Plot edit mode
        2. 12.2.2 Property Editor
      3. 12.3 Animation
        1. 12.3.1 Animation with Handle Graphics
      4. 12.4 Color etc.
        1. 12.4.1 Colormaps
        2. 12.4.2 Color of surface plots
        3. 12.4.3 Truecolor
      5. 12.5 Lighting and camera
      6. 12.6 Saving, printing and exporting graphs
        1. 12.6.1 Saving and opening figure files
        2. 12.6.2 Printing a graph
        3. 12.6.3 Exporting a graph
    13. Chapter 13 *Graphical User Interfaces (GUIs)
      1. 13.1 Basic structure of a GUI
      2. 13.2 A first example: getting the time
        1. 13.2.1 Exercise
      3. 13.3 Newton again
      4. 13.4 Axes on a GUI
      5. 13.5 Adding color to a button
  8. PART II: APPLICATIONS
    1. Chapter 14 Dynamical systems
      1. 14.1 Cantilever beam
      2. 14.2 Electric current
      3. 14.3 Free fall (1/2)
      4. 14.3 Free fall (2/2)
      5. 14.4 Projectile with friction
    2. Chapter 15 Simulation
      1. 15.1 Random number generation
        1. 15.1.1 Seeding rand
      2. 15.2 Spinning coins
      3. 15.3 Rolling dice
      4. 15.4 Bacteria division
      5. 15.5 A random walk
      6. 15.6 Traffic flow
      7. 15.7 Normal (Gaussian) random numbers
    3. Chapter 16 *More matrices
      1. 16.1 Leslie matrices: population growth
      2. 16.2 Markov processes
        1. 16.2.1 A random walk
      3. 16.3 Linear equations (1/2)
      4. 16.3 Linear equations (2/2)
        1. 16.3.1 MATLAB's solution
        2. 16.3.2 The residual
        3. 16.3.3 Overdetermined systems
        4. 16.3.4 Underdetermined systems
        5. 16.3.5 Ill conditioning
        6. 16.3.6 Matrix division
      5. 16.4 Sparse matrices
    4. Chapter 17 *Introduction to numerical methods
      1. 17.1 Equations
        1. 17.1.1 Newton's method
        2. 17.1.2 The Bisection method
        3. 17.1.3 fzero
        4. 17.1.4 roots
      2. 17.2 Integration
        1. 17.2.1 The Trapezoidal rule
        2. 17.2.2 Simpson's rule
        3. 17.2.3 quad
      3. 17.3 Numerical differentiation
        1. 17.3.1 diff
      4. 17.4 First-order differential equations
        1. 17.4.1 Euler's method
        2. 17.4.2 Example: bacteria growth
        3. 17.4.3 Alternative subscript notation
        4. 17.4.4 A predictor-corrector method
      5. 17.5 Linear ordinary differential equations (LODEs)
      6. 17.6 Runge-Kutta methods (1/2)
      7. 17.6 Runge-Kutta methods (2/2)
        1. 17.6.1 A single differential equation
        2. 17.6.2 Systems of differential equations: chaos
        3. 17.6.3 Passing additional parameters to an ODE solver
      8. 17.7 A partial differential equation
        1. 17.7.1 Heat conduction
      9. 17.8 Other numerical methods
  9. Appendix A: Syntax quick reference
    1. A.1 Expressions
    2. A.2 Function M-files
    3. A.3 Graphics
    4. A.4 if and switch
    5. A.5 for and while
    6. A.6 Input/output
    7. A.7 load/ save
    8. A.8 Vectors and matrices
  10. Appendix B: Operators
  11. Appendix C: Command and functionquick reference
    1. C.1 General purpose commands
      1. C.1.1 Managing commands
      2. C.1.2 Managing variables and the workspace
      3. C.1.3 Files and the operating system
      4. C.1.4 Controlling the Command Window
      5. C.1.5 Starting and quitting MATLAB
    2. C.2 Logical functions
    3. C.3 Language constructs and debugging
      1. C.3.1 MATLAB as a programming language
      2. C.3.2 Interactive input
    4. C.4 Matrices and matrix manipulation
      1. C.4.1 Elementary matrices
      2. C.4.2 Special variables and constants
      3. C.4.3 Time and date
      4. C.4.4 Matrix manipulation
      5. C.4.5 Specialized matrices
    5. C.5 Mathematical functions
    6. C.6 Matrix functions
    7. C.7 Data analysis
    8. C.8 Polynomial functions
    9. C.9 Function functions
    10. C.10 Sparse matrix functions
    11. C.11 Character string functions
    12. C.12 File I/O functions
    13. C.13 Graphics
      1. C.13.1 2-D
      2. C.13.2 3-D
      3. C.13.3 General
  12. Appendix D: ASCII character codes
  13. Appendix E: Solutions to selected exercises (1/3)
  14. Appendix E: Solutions to selected exercises (2/3)
  15. Appendix E: Solutions to selected exercises (3/3)
  16. Index
    1. A
    2. B
    3. C
    4. D
    5. E
    6. F
    7. G
    8. H
    9. I
    10. J
    11. K
    12. L
    13. M
    14. N
    15. O
    16. P
    17. Q
    18. R
    19. S
    20. T
    21. U
    22. V
    23. W
    24. X
    25. Y
    26. Z

Product information

  • Title: Essential MATLAB for Engineers and Scientists, 3rd Edition
  • Author(s): Brian Hahn, Daniel Valentine
  • Release date: January 2007
  • Publisher(s): Newnes
  • ISBN: 9780080471501