# MATLAB® by Example

## 1st Edition

### Programming Basics

**Authors:**Munther Gdeisat Francis Lilley

**eBook ISBN:**9780124058538

**Hardcover ISBN:**9780124052123

**Imprint:**Elsevier

**Published Date:**15th January 2013

**Page Count:**366

## Description

*MATLAB By Example* guides the reader through each step of writing MATLAB programs. The book assumes no previous programming experience on the part of the reader, and uses multiple examples in clear language to introduce concepts and practical tools. Straightforward and detailed instructions allow beginners to learn and develop their MATLAB skills quickly.

The book consists of ten chapters, discussing in detail the integrated development environment (IDE), scalars, vectors, arrays, adopting structured programming style using functions and recursive functions, control flow, debugging, profiling, and structures. A chapter also describes Symbolic Math Toolbox, teaching readers how to solve algebraic equations, differentiation, integration, differential equations, and Laplace and Fourier transforms. Containing hundreds of examples illustrated using screen shots, hundreds of exercises, and three projects, this book can be used to complement coursework or as a self-study book, and can be used as a textbook in universities, colleges and high schools.

## Key Features

- No programming experience necessary to learn MATLAB
- Examples with screenshots and plentiful exercises throughout help make MATLAB easy to understand
- Projects enable readers to write long MATLAB programs, and take the first step toward being a professional MATLAB programmer

## Readership

Students and professionals in engineering and related fields who need to learn Matlab programming.

## Table of Contents

Preface

Acknowledgments

Why This Book Is Different

How This Book Is Organized

1. Matlab Integrated Development Environment

Lesson 1.1 Basics of the Matlab Integrated Development Environment

Lesson 1.2 Matlab Script Files

Lesson 1.3 Matlab Editor—Cell Mode

Answers to Selected Exercises

2. Scalars in Matlab

Lesson 2.1 Creating and Naming Matlab Scalar Variables

Lesson 2.2 Approximation of Numbers and Discrete Mathematical Operations

Lesson 2.3 Mathematical Expressions for Scalar Variables

Lesson 2.4 Relational and Logical Operations for Scalar Variables

Lesson 2.5 Complex Scalar Variables

Answers to Selected Exercises

3. Vectors in Matlab

Lesson 3.1 Creating Vectors

Lesson 3.2 Relational and Logical Operations on Vectors

Lesson 3.3 Accessing Elements in Vectors

Lesson 3.4 Arithmetical Operations on Vectors

Lesson 3.5 Plotting Vectors

Answers to Selected Exercises

4. Arrays in Matlab

Lesson 4.1 Creating Arrays

Lesson 4.2 Relational and Logical Operations on Arrays

Lesson 4.3 Accessing Elements in Arrays

Lesson 4.4 Arithmetical Operations on Arrays

Lesson 4.5 Plotting Arrays

Answers to Selected Exercises

5. Matlab Functions

Lesson 5.1 Introduction to Functions

Lesson 5.2 Creating Functions

Lesson 5.3 Scope of Matlab Variables in a Function

Answers to Selected Exercises

Lesson 5.3

6. Conditional Statements in Matlab

Lesson 6.1 The Construction of an if Statement

Lesson 6.2 The Construction of an if else Statement

Lesson 6.3 Recursive Functions

Lesson 6.4 The Construction of an if elseif else Statement

Lesson 6.5 The Construction of a switch case Statement

Answers to Selected Exercises

7. Loop Statements in Matlab

Lesson 7.1 The Construction of a for Loop Statement

Lesson 7.2 The Construction of Combined for and if Statements

Lesson 7.3 The Construction of a while Loop Statement

Answers to Selected Exercises

Projects

8. Matlab Debugging, Profiling, and Code Indentation

Lesson 8.1 Matlab Debugging

Lesson 8.2 Debugging Matlab Functions

Lesson 8.3 Advanced Matlab Debugging Tools

Lesson 8.4 The Matlab Profiler Tool

Lesson 8.5 Matlab Code Indentation

Answers to Selected Exercises

9. Structures in Matlab

Lesson 9.1 Structures in Matlab

Lesson 9.2 A Vector of Structures

Answers to Selected Exercises

Project: The Fox and Rabbit Game

10. Calculus in Matlab

Lesson 10.1 Introduction to Symbolic Math Toolbox

Lesson 10.2 Algebraic Equations

Lesson 10.3 Differentiation and Integration

Lesson 10.4 Differential Equations

Lesson 10.5 Laplace and Fourier Transforms

Answers to Selected Exercises

## Details

- No. of pages:
- 366

- Language:
- English

- Copyright:
- © Elsevier 2013

- Published:
- 15th January 2013

- Imprint:
- Elsevier

- eBook ISBN:
- 9780124058538

- Hardcover ISBN:
- 9780124052123

## About the Author

### Munther Gdeisat

### Affiliations and Expertise

Information Technology Department, College of Applied Sciences, Sohar, Sultanate of Oman

### Francis Lilley

### Affiliations and Expertise

General Engineering Research Institute (GERI), Liverpool John Moores University, Liverpool, UK