## Table of Contents

1. Starting with MATLAB

1.1 Starting MATLAB, MATLAB windows

1.2 Working in the command window

1.3 Arithmetic operations with scalars

1.4 Display formats

1.5 Elementary math built-in functions

1.6 Defining scalar variables

1.7 Useful commands for managing variables

1.8 Script files

1.9 Examples of MATLAB applications

1.10 Problems

2. Creating Arrays

2.1 Creating a one-dimensional array (vector)

2.2 Creating a two-dimensional array (matrix)

2.3 Notes about variables in MATLAB

2.4 The transpose operator

2.5 Array addressing

2.6 Using a colon : in addressing arrays

2.7 Adding elements to existing variables

2.8 Deleting elements

2.9 Built-in functions for handling arrays

2.10 Strings and strings as variables

2.11 Problems

3. Mathematical Operations with Arrays

3.1 Addition and subtraction

3.2 Array multiplication

3.3 Array division

3.4 Element-by-element operations

3.5 Using arrays in MATLAB built-in math functions

3.6 Built-in functions for analyzing arrays

3.7 Generation of random numbers

3.8 Examples of MATLAB applications

3.9 Problems

4. Using Script Files and Managing Data

4.1 The MATLAB workspace and the workspace window

4.2 Input to a script file

4.3 Output commands

4.4 The save and load commands

4.5 Importing and exporting data

4.6 Examples of MATLAB applications

4.7 Problems

5. Two-dimensional plots

5.1 The plot command

5.2 The fplot command

5.3 Plotting multiple graphs in the same plot

5.4 Formatting a plot

5.5 Plots with logarithmic axes

5.6 Plots with error bars

5.7 Plots with special graphics

5.8 Histograms

5.9 Polar plots

5.10 Putting multiple plots on the same page

5.11 Multiple figure windows

5.12 Plotting using the plots toolstrip

5.13 Examples of MATLAB applications

5.14 Problems

6. Programming in MATLAB

6.1 Relational and logical operators

6.2 Conditional statements

6.3 The switch-case statement

6.4 Loops

6.5 Nested loops and nested conditional statements

6.6 The break and continue commands

6.7 Examples of MATLAB applications

6.8 Problems

7. User-Defined Functions and Function Files

7.1 Creating a function file

7.2 Structure of a function file

7.3 Local and global variables

7.4 Saving a function file

7.5 Using a user-defined function

7.6 Examples of simple user-defined functions

7.7 Comparison between script files and function files

7.8 Local functions

7.9 Anonymous functions

7.10 Function functions

7.11 Subfunctions

7.12 Nested functions

7.13 Examples of MATLAB applications

7.14 Problems

8. Polynomials, Curve Fitting, and Interpolation

8.1 Polynomials

8.2 Curve fitting

8.3 Interpolation

8.4 The basic fitting interface

8.5 Examples of MATLAB applications

8.6 Problems

9. Applications In Numerical Analysis

9.1 Solving an equation with one variable

9.2 Finding a minimum or a maximum of a function

9.3 Numerical integration

9.4 Ordinary differential equations

9.5 Examples of MATLAB applications

9.6 Problems

10. Three-dimensional plots

10.1 Line plots

10.2 Mesh and surface plots

10.3 Plots with special graphics

10.4 The view command

10.5 Examples of MATLAB applications

10.6 Problems

11. Symbolic Math

11.1 Symbolic objects and symbolic expressions

11.2 Changing the form of an existing symbolic expression

11.3 Solving algebraic equations

11.4 Differentiation

11.5 Integration

11.6 Solving an ordinary differential equation

11.7 Plotting symbolic expressions

11.8 Numerical calculations with symbolic expressions

11.9 Examples of MATLAB applications

11.10 Problems

12. Appendix: Summary of Characters, Commands, and Functions

12.1 Appendix: Summary of Characters, Commands, and Functions

## Same Text, More Action

Based on the 6th edition of ** MATLAB: An Introduction to Applications**, the zyVersion contains the complete text of the original book plus new interactive animations and learning questions to engage the student.

- Over 20 dynamic animations provide insight into numerous topics
- More than 50 learning question sets help students understand topics through incremental steps keeping students engaged and providing thorough explanations of both right and wrong answers

### Now available – zyLabs with MATLABÂ® Graderâ„¢

Available for a modest extra cost, MATLABÂ® zyLabs is a program submission and auto-grading system. MATLABÂ® zyLabs is an implementation of MATLABÂ® Graderâ„¢ within the zyVersion through our partnership with MathWorks.

- Instructors can create labs and assessments using features built into MATLABÂ® zyLabs and write scripts for custom assessments – no software installation required
- MATLABÂ® zyLabs are fully integrated into the zyVersion and provide students access to MATLAB’s industry standard toolboxes
- Students can run MATLABÂ® commands directly in zyLabs, avoiding the complexity of using external tools
- Students receive immediate feedback on their submissions and can correct and resubmit their solutions, increasing student learning and motivation

## What is a zyVersion?

zyVersions are leading print titles converted and adapted to zyBooksâ€™ interactive learning platform, allowing for a quick and easy transition to an engaging digital experience for instructors and students.

zyBooksâ€™ web-native content helps students visualize concepts to learn faster and more effectively than with a traditional textbook.

This zyVersion of **MATLAB: An Introduction with Applications (6e)** benefits both students and instructors:

- Instructor benefits
- Customize your course by reorganizing existing content, or adding your own content
- Continuous publication model updates your course with the latest content and technologies
- Robust reporting gives you insight into studentsâ€™ progress, reading and participation

- Student benefits
- Learning questions and other content serve as an interactive form of reading and provide instant feedback
- Concepts come to life through extensive animations embedded into the interactive content
- Save chapters as PDFs to reference material at any time,

even after the course has been completed

## Author:

**Amos Gilat**

*The Ohio State University*

## Contributor:

**Adrian Rodriguez**

*Content Developer / zyBooks*