# MATLAB® by Example

## 1st Edition

**Programming Basics**

**Programming Basics**

*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.

- 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

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

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

Les

- No. of pages:
- 366

- Language:
- English

- Copyright:
- © 2013

- Published:
- 15th January 2013

- Imprint:
- Elsevier

- Print ISBN:
- 9780124052123

- Electronic ISBN:
- 9780124058538

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

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