# MATLAB Programming for Engineers 6th edition

Stephen J. Chapman
Publisher: Cengage Learning

## Course Packs

Save time with ready-to-use assignments built by subject matter experts specifically for this textbook. You can customize and schedule any of the assignments you want to use.

## Textbook Resources

Additional instructional and learning resources are available with the textbook, and might include testbanks, slide presentations, online simulations, videos, and documents.

• Chapman MATLAB Programming for Engineers 6e

Access is contingent on use of this textbook in the instructor's classroom.

• Chapter 1: Introduction to MATLAB
• 1.1: The Advantages of MATLAB
• 1.3: The MATLAB Environment (1)
• 1.4: Using MATLAB as a Calculator (5)
• 1.5: MATLAB Script Files (6)
• 1.6: Summary
• 1.7: Exercises
• 1: Chapter Quiz (20)

• Chapter 2: MATLAB Basics
• 2.1: Variables and Arrays (2)
• 2.2: Creating and Initializing Variables in MATLAB (2)
• 2.3: Multidimensional Arrays
• 2.4: Subarrays
• 2.5: Special Values
• 2.6: Displaying Output Data (1)
• 2.7: Data Files
• 2.8: Scalar and Array Operations (3)
• 2.9: Hierarchy of Operations (1)
• 2.10: Built-in MATLAB Functions
• 2.11: Introduction to Plotting (2)
• 2.12: Examples (16)
• 2.13: MATLAB Applications: Vector Mathematics (4)
• 2.14: MATLAB Applications: Matrix Operations and Simultaneous Equations (1)
• 2.15: Debugging MATLAB Programs
• 2.16: Summary
• 2.17: Exercises
• 2: Chapter Quiz (20)

• Chapter 3: Two-Dimensional Plots
• 3.1: Additional Plotting Features for Two-Dimensional Plots (8)
• 3.2: Polar Plots (3)
• 3.3: Annotating and Saving Plots (1)
• 3.4: Additional Types of Two-Dimensional Plots (3)
• 3.5: Using the plot Function with Two-Dimensional Arrays
• 3.6: Plots with Two Y-Axes (7)
• 3.7: Summary
• 3.8: Exercises
• 3: Chapter Quiz (19)

• Chapter 4: Branching Statements and Program Design
• 4.1: Introduction to Top-Down Design Techniques
• 4.2: Use of Pseudocode
• 4.3: The Logical Data Type (1)
• 4.4: Branches (11)
• 4.5: More on Debugging MATLAB Programs
• 4.6: Code Sections
• 4.7: MATLAB Applications: Roots of Polynomials (2)
• 4.8: Summary
• 4.9: Exercises
• 4: Chapter Quiz (20)

• Chapter 5: Loops and Vectorization
• 5.1: The while Loop (2)
• 5.2: The for Loop (33)
• 5.3: Logical Arrays and Vectorization (2)
• 5.4: The MATLAB Profiler
• 5.6: The textread Function (1)
• 5.7: MATLAB Applications: Statistical Functions
• 5.8: MATLAB Applications: Curve Fitting and Interpolation (2)
• 5.9: Summary
• 5.10: Exercises
• 5: Chapter Quiz (20)

• Chapter 6: Basic User-Defined Functions
• 6.1: Introduction to MATLAB Functions (1)
• 6.2: Variable Passing in MATLAB: The Pass-By-Value Scheme (13)
• 6.3: Optional Arguments (1)
• 6.4: Sharing Data Using Global Memory (19)
• 6.5: Preserving Data Between Calls to a Function
• 6.6: Built-in MATLAB Functions: Sorting Functions (2)
• 6.7: Built-in MATLAB Functions: Random Number Functions
• 6.8: Summary
• 6.9: Exercises
• 6: Chapter Quiz (21)

• Chapter 7: Advanced Features of User-Defined Functions
• 7.1: Function Functions (2)
• 7.2: Function Handles (2)
• 7.3: Functions eval and feval
• 7.4: Local Functions, Private Functions, and Nested Functions (17)
• 7.5: An Example Application: Solving Ordinary Differential Equations (3)
• 7.6: Anonymous Functions (4)
• 7.7: Recursive Functions (1)
• 7.8: Plotting Functions
• 7.9: Histograms (3)
• 7.10: An Example Application: Numerical Integration
• 7.11: Summary
• 7.12: Exercises
• 7: Chapter Quiz (20)

• Chapter 8: Complex Numbers and Additional Plots
• 8.1: Complex Data (10)
• 8.2: Multidimensional Arrays
• 8.3: Gallery of MATLAB Plots (13)
• 8.4: Line Plots
• 8.5: Discrete Data Plots
• 8.6: Polar Plots
• 8.7: Contour Plots
• 8.8: Surface and Mesh Plots
• 8.9: Pie Charts, Bar Plots, and Histograms
• 8.10: Color Order, Color Maps, and Color Bars
• 8.11: Summary
• 8.12: Exercises
• 8: Chapter Quiz (21)

• Chapter 9: Additional Data Types
• 9.1: Character Arrays versus Strings (14)
• 9.2: Character Arrays and Character Functions
• 9.3: The string Data Type (3)
• 9.4: Summary of Character Array and String Functions
• 9.5: The single Data Type
• 9.6: Integer Data Types (2)
• 9.7: Limitations of the single and Integer Data Types
• 9.8: The datetime and duration Data Types (4)
• 9.9: Summary
• 9.10: Exercises
• 9: Chapter Quiz (20)

• Chapter 10: Sparse Arrays, Cell Arrays, Structures, and Tables
• 10.1: Sparse Arrays
• 10.2: Cell Arrays (10)
• 10.3: Structure Arrays (8)
• 10.4: Table Arrays (3)
• 10.5: Summary
• 10.6: Exercises
• 10: Chapter Quiz (20)

• Chapter 11: Input/Output Functions
• 11.1: The textread Function (1)
• 11.3: An Introduction to MATLAB File Processing (1)
• 11.4: File Opening and Closing
• 11.5: Binary I/O Functions (1)
• 11.6: Formatted I/O Functions (9)
• 11.7: Comparing Formatted and Binary I/O Functions
• 11.8: File Positioning and Status Functions (3)
• 11.9: The textscan Function
• 11.10: Function uiimport
• 11.11: Summary
• 11.12: Exercises
• 11: Chapter Quiz (20)

• Chapter 12: User-Defined Classes and Object-Oriented Programming
• 12.1: An Introduction to Object-Oriented Programming
• 12.2: The Structure of a MATLAB Class
• 12.3: Value Classes versus Handle Classes
• 12.4: Destructors: The delete Method
• 12.5: Access Methods and Access Controls (8)
• 12.6: Static Methods
• 12.7: Defining Class Methods in Separate Files
• 12.8: Overriding Operators
• 12.9: Events and Listeners
• 12.10: Exceptions
• 12.11: Superclasses and Subclasses (1)
• 12.12: Summary (1)
• 12.13: Exercises
• 12: Chapter Quiz (20)

• Chapter 13: Handle Graphics and Animation
• 13.1: Handle Graphics (1)
• 13.2: The MATLAB Graphics System
• 13.3: Object Handles
• 13.4: Examining and Changing Object Properties (4)
• 13.5: Using set to List Possible Property Values
• 13.6: User-Defined Data
• 13.7: Finding Objects
• 13.8: Selecting Objects with the Mouse (4)
• 13.9: Position and Units
• 13.10: Printer Positions
• 13.11: Default and Factory Properties
• 13.12: Restoring Default Properties
• 13.13: Graphics Object Properties
• 13.14: Animations and Movies (3)
• 13.15: Summary
• 13.16: Exercises
• 13: Chapter Quiz (20)

• Chapter 14: MATLAB Apps and Graphical User Interfaces
• 14.1: How a Graphical User Interface Works (2)
• 14.2: Creating and Displaying a Graphical User Interface (2)
• 14.3: Object Properties
• 14.4: Additional Containers: Panels, Tab Groups, and Button Groups (6)
• 14.5: Dialog Boxes (1)
• 14.7: Summary
• 14.8: Exercises
• 14: Chapter Quiz (20)

• Chapter 15: Guide-Based Graphical User Interfaces
• 15.1: How a Graphical User Interface Works (2)
• 15.2: Creating and Displaying a Graphical User Interface (2)
• 15.3: Object Properties
• 15.4: Graphical User Interface Components
• 15.5: Additional Containers: Panels and Button Groups
• 15.6: Dialog Boxes (1)
• 15.8: Tips for Creating Efficient GUIs
• 15.9: Summary
• 15.10: Exercises
• 15: Chapter Quiz

The 6th Edition of Stephen J. Chapman's highly successful MATLAB® Programming for Engineers teaches MATLAB® as a technical programming language with an emphasis on problem-solving skills. Students learn how to write clean, efficient, and well-documented programs, while gaining an understanding of the many practical functions of MATLAB®. The first nine chapters support and provide a primary resource for today's introduction to programming and problem-solving course for first-year engineering students. The remaining chapters address more advanced topics, such as I/O, object-oriented programming and Graphical User Interfaces. This serves as an ideal resource for a longer course or as a valuable reference tool for engineering students or practicing engineers who use MATLAB®. Available via WebAssign is MindTap Reader, Cengage's next-generation eBook, and other digital resources.

#### Meet the Author

Stephen J. Chapman, BAE Systems Australia
Stephen J. Chapman received a B.S. in Electrical Engineering from Louisiana State University and an M.S.E. in Electrical Engineering from the University of Central Florida. He pursued further graduate studies at Rice University. Mr. Chapman has served as an officer in the U.S. Navy, assigned to teach Electrical Engineering at the U.S. Naval Nuclear Power School in Orlando, Florida. He was also affiliated with the University of Houston, where he ran the power systems program in the College of Technology. In addition, he has served as a member of the technical staff of the Massachusetts Institute of Technology's Lincoln Laboratory, both at the main facility in Lexington, Massachusetts, and at the field site on Kwajalein Atoll in the Republic of the Marshall Islands. While there, he did research in radar signal processing systems. He ultimately became the leader of four large operational range instrumentation radars at the Kwajalein field site (TRADEX, ALTAIR, ALCOR, and MMW). Mr. Chapman also served as a research engineer at Shell Development Company in Houston, Texas, where he conducted seismic signal processing research. In addition, he was affiliated with the University of Houston, where he continued to teach on a part-time basis. Mr. Chapman is currently Manager of Systems Modeling and Operational Analysis for BAE Systems Australia in Melbourne, Australia. He is the subject matter expert of a team that has developed a model of how naval ships defend themselves. This model contains more than 400,000 lines of MATLAB® code written over more than a decade. Mr. Chapman is a Senior Member of the Institute of Electrical and Electronic Engineers (and several of its component societies). He is also a member of the Institution of Engineers (Australia).

#### Digital Content Update 2020

• 281 New Chapter Quiz Questions

#### Features

• Watch It links provide step-by-step instruction with short, engaging videos that are ideal for visual learners.
• Chapter Quiz questions in each chapter encourage students to test and apply what they have learned in each chapter. These questions can serve as a quick and useful self-test to help confirm understanding of each concept.
• A Course Pack with ready-to-use assignments built by subject matter experts specifically for this textbook is designed to save you time, and it can be easily customized to meet your teaching goals.
• Customizable Lecture Slides, a complete Instructor Solution Manual, an Online-Only Chapter 15 (Online chapter about Guide-Based Graphical User Interfaces), Image Banks (Digital image files from the text), Appendix A (UTF-8 Character Set), Errata (Corrected errors from earlier printings), and Student MATLAB® Files are available as textbook resources.
• A WebAssign Educator Guide is included as a textbook resource to assist you in creating and maintaining your unique WebAssign course experience utilizing the resources developed specifically for this title.

## Questions Available within WebAssign

Most questions from this textbook are available in WebAssign. The online questions are identical to the textbook questions except for minor wording changes necessary for Web use. Whenever possible, variables, numbers, or words have been randomized so that each student receives a unique version of the question. This list is updated nightly.

##### Question Availability Color Key
BLACK questions are available now
GRAY questions are under development

Group Quantity Questions
Chapter 1: Introduction to MATLAB
1.CQ 20 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020
1.3 1 012
1.4 5 004 005 007 008 011
1.5 6 001 006 009 010 014 015
Chapter 2: MATLAB Basics
2.CQ 20 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020
2.1 2 001 002
2.2 2 003 004
2.6 1 005
2.8 3 006 008 009
2.9 1 007
2.11 2 021 022
2.12 16 012 013 014 015 016 017 023 024 025 026 027 028 029 030 031 032
2.13 4 011 018 019 020
2.14 1 010
Chapter 3: Two-Dimensional Plots
3.CQ 19 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019
3.1 8 001 003 006 007 010 011 012 013
3.2 3 005 014 018
3.3 1 002
3.4 3 004 008 009
3.6 7 015 016 017 019 020 021 022
Chapter 4: Branching Statements and Program Design
4.CQ 20 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020
4.3 1 001
4.4 11 002 003 004 005 006 007 008 011 012 013 014
4.7 2 009 010
Chapter 5: Loops and Vectorization
5.CQ 20 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020
5.1 2 008 024
5.2 33 001 002 003 004 005 006 007 011 012 013 014 015 017 019 020 021 022 023 025 026 027 028 029 030 032 033 034 035 036 037 038 039 040
5.3 2 009 010
5.6 1 016
5.8 2 018 031
Chapter 6: Basic User-Defined Functions
6.CQ 21 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021
6.1 1 001
6.2 13 002 003 005 006 007 008 009 010 011 012 013 014 015
6.3 1 004
6.4 19 016 017 018 019 020 021 022 023 024 025 026 029 030 031 032 033 034 035 036
6.6 2 027 028
Chapter 7: Advanced Features of User-Defined Functions
7.CQ 20 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020
7.1 2 022 026
7.2 2 014 015
7.4 17 001 002 003 005 007 010 011 012 013 017 018 019 020 021 024 027 029
7.5 3 028 031 032
7.6 4 004 006 023 030
7.7 1 025
7.9 3 008 009 016
Chapter 8: Complex Numbers and Additional Plots
8.CQ 21 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021
8.1 10 001 002 003 004 005 006 007 008 009 010
8.3 13 011 012 013 014 015 016 017 018 019 020 021 022 023
9.CQ 20 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020
9.1 14 001 002 003 004 005 006 007 010 011 012 013 014 015 016
9.3 3 008 009 017
9.6 2 018 019
9.8 4 020 021 022 023
Chapter 10: Sparse Arrays, Cell Arrays, Structures, and Tables
10.CQ 20 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020
10.2 10 001 002 003 004 013 014 015 016 017 018
10.3 8 005 006 007 008 009 010 011 012
10.4 3 019 020 021
Chapter 11: Input/Output Functions
11.CQ 20 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020
11.1 1 015
11.3 1 001
11.5 1 010
11.6 9 002 003 004 008 009 011 012 013 014
11.8 3 005 006 007
Chapter 12: User-Defined Classes and Object-Oriented Programming
12.CQ 20 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020
12.5 8 001 002 003 004 005 008 009 010
12.11 1 007
12.12 1 006
Chapter 13: Handle Graphics and Animation
13.CQ 20 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020
13.1 1 001
13.4 4 002 003 005 008
13.8 4 004 006 007 013
13.14 3 010 011 012
Chapter 14: MATLAB Apps and Graphical User Interfaces
14.CQ 20 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020
14.1 2 002 003
14.2 2 001 004
14.4 6 006 007 008 010 011 015
14.5 1 014
14.6 7 005 009 012 013 016 017 018
Chapter 15: Guide-Based Graphical User Interfaces
15.1 2 002 003
15.2 2 001 004
15.6 1 013
15.7 12 005 006 007 008 009 010 011 012 014 015 016 017
Total 608