# MATLABÂ® by Example

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

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

Hardbound, 366 Pages

Published: January 2013

Imprint: Elsevier

ISBN: 978-0-12-405212-3

## Contents

• Chapter 1: Matlab Integrated Development Environment (IDE)
1.1: Basics of Matlab Integrated Development Environment (IDE)
1.2: Creating Matlab Script Files
1.3: Matlab Editor - Cell Mode

Chapter 2: Scalars in Matlab
2.1: Creating and Naming Matlab Scalar Variables
2.2: Approximation of Numbers and Discrete Math Operations
2.3: Mathematical Expressions for Scalar Variables
2.4: Relational and Logical Operations for Scalar Variables
2.5: Complex Scalar Variables

Chapter 3: Vectors in Matlab
3.1: Creating Vectors
3.2: Relational and Logical Operations on Vectors
3.3: Accessing Elements in Vectors
3.4: Arithmetical Operations on Vectors
3.5: Plotting Vectors

Chapter 4: Arrays in Matlab
4.1: Creating Arrays
4.2: Relational and Logical Operations on Arrays
4.3: Accessing Elements in Arrays
4.4: Arithmetical Operations on Arrays
4.5: Plotting Arrays

Chapter 5: Matlab Functions
5.1: Introduction to Functions
5.2: Creating Matlab Functions
5.3: Scope of Matlab Variables in a Function

Chapter 6: Conditional Statements in Matlab
6.1: The Construction of an if Statement
6.2: The Construction of an if else Statement
6.3: The Construction of an if elseif else Statement
6.4: The Construction of a switch case Statement

Chapter 7: Loop Statements in Matlab
7.1: The Construction of a for Loop Statement
7.2: The Construction of Combined for and if Statements
7.3: The Construction of a while Loop Statement
7.4: Project 1: Conwayâs Game of Life
7.5: Project 2: Conwayâs Game of Life - Wrapped Edges

Chapter 8: Matlab Debugging, Profiling and Code Indentation
8.1: Matlab Debugging
8.2: Debugging Matlab Functions
8.4: The Matlab Profiler Tool
8.5: Matlab Code Indentation

Chapter 9: Structures in Matlab
9.1: Structures in Matlab
9.2: A Vector of Structures
9.3: Project: Fox and Rabbit Game

Chapter 10: Calculus in Matlab

10.1: Introduction to Symbolic Math Toolbox

10.2: Algebraic Equations

10.3: Differentiation and Integrations

10.4: Differential Equations

10.5: Fourier and Laplace Transforms