Matlab by Example

Programming Basics

By
  • Munther Gdeisat, Information Technology Department, College of Applied Sciences, Sohar, Sultanate of Oman
  • Francis Lilley, General Engineering Research Institute (GERI), Liverpool John Moores University, Liverpool, UK

This book is designed to guide the reader through each step of writing Matlab programs. The book begins assuming the reader has no previous programming experience, and it uses multiple examples and clear language to introduce concepts and practical tools. The straight-forward and detailed instructions provide quick and thorough learning of Matlab for the beginner, allowing them to improve quickly in a short time. The book consists of ten chapters and it discusses 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 section also describes the Symbolic Math toolbox, teaching readers how to solve algebraic equations, differentiation, integration, differential equations, and Laplace and Fourier transforms. The book contains hundreds of examples illustrated using screen shots, hundreds of exercises and three projects. The book can be used to complement coursework or as a self-study book. This book can be used as a textbook in Universities, colleges and high schools. The reader does not need to have any previous programming experience to learn Matlab. It includes examples with screenshots and plentiful exercises throughout help make Matlab easy to understand. Three larger projects enable the reader to write more extensive Matlab programs, giving them valuable practical programming experience and providing a first step towards being a professional Matlab programmer.

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
    3.6: Answers to Selected Exercises

    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
    5.4: Answers to Selected Exercises

    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.3: Advanced Matlab Debugging Tools
    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

    10.6: Answers to Selected Exercises

Advertisement

advert image