0% found this document useful (0 votes)
206 views10 pages

MATLAB: A Practical Introduction to Programming and Problem Solving (5th Edition) PDF

The document provides information about the book 'MATLAB: A Practical Introduction to Programming and Problem Solving, Fifth Edition' by Stormy Attaway, which is available for download on YakiBooki.com. It outlines the book's purpose, which is to teach programming concepts and problem-solving skills using MATLAB, and highlights key features such as a systematic approach, user-defined functions, and advanced programming concepts. The document also includes details about the book's publication, copyright information, and modifications made in the fifth edition.

Uploaded by

Ana Vitória
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
206 views10 pages

MATLAB: A Practical Introduction to Programming and Problem Solving (5th Edition) PDF

The document provides information about the book 'MATLAB: A Practical Introduction to Programming and Problem Solving, Fifth Edition' by Stormy Attaway, which is available for download on YakiBooki.com. It outlines the book's purpose, which is to teach programming concepts and problem-solving skills using MATLAB, and highlights key features such as a systematic approach, user-defined functions, and advanced programming concepts. The document also includes details about the book's publication, copyright information, and modifications made in the fifth edition.

Uploaded by

Ana Vitória
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

This Book is Available on YakiBooki.

com

https://www.yakibooki.com/download/matlab-a-practical-introduction-to-programming-and-problem-solving-5th-edition/
This Book is Available on YakiBooki.com

MATLAB®
A Practical Introduction to Programming
and Problem Solving

https://www.yakibooki.com/download/matlab-a-practical-introduction-to-programming-and-problem-solving-5th-edition/
This Book is Available on YakiBooki.com

®
MATLAB
A Practical Introduction to Programming
and Problem Solving

Fifth Edition

Stormy Attaway
Department of Mechanical Engineering
Boston University

https://www.yakibooki.com/download/matlab-a-practical-introduction-to-programming-and-problem-solving-5th-edition/
This Book is Available on YakiBooki.com

Butterworth-Heinemann is an imprint of Elsevier


The Boulevard, Langford Lane, Kidlington, Oxford OX5 1GB, United Kingdom
50 Hampshire Street, 5th Floor, Cambridge, MA 02139, United States

© 2019 Elsevier Inc. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or by any means, electronic or
mechanical, including photocopying, recording, or any information storage and retrieval system, without
permission in writing from the publisher. Details on how to seek permission, further information about the
Publisher’s permissions policies and our arrangements with organizations such as the Copyright Clearance
Center and the Copyright Licensing Agency, can be found at our website: www.elsevier.com/permissions.

This book and the individual contributions contained in it are protected under copyright by the Publisher
(other than as may be noted herein).

Notices
Knowledge and best practice in this field are constantly changing. As new research and experience
broaden our understanding, changes in research methods, professional practices, or medical treatment may
become necessary.

Practitioners and researchers must always rely on their own experience and knowledge in evaluating and
using any information, methods, compounds, or experiments described herein. In using such information or
methods they should be mindful of their own safety and the safety of others, including parties for whom they
have a professional responsibility.

To the fullest extent of the law, neither the Publisher nor the authors, contributors, or editors, assume any
liability for any injury and/or damage to persons or property as a matter of products liability, negligence
or otherwise, or from any use or operation of any methods, products, instructions, or ideas contained in the
material herein.

MATLAB® is a registered trademark of The MathWorks, Inc., and is used with permission.

Library of Congress Cataloging-in-Publication Data


A catalog record for this book is available from the Library of Congress

British Library Cataloguing-in-Publication Data


A catalogue record for this book is available from the British Library

ISBN: 978-0-12-815479-3

For information on all Butterworth-Heinemann publications visit


our website at https://www.elsevier.com/books-and-journals

Publisher: Katey Birtcher


Acquisition Editor: Stephen Merken
Sr. Content Development Specialist: Nate McFadden
Production Project Manager: Sujatha Thirugnana Sambandam
Cover Designer: Greg Harris

Typeset by SPi Global, India

https://www.yakibooki.com/download/matlab-a-practical-introduction-to-programming-and-problem-solving-5th-edition/
This Book is Available on YakiBooki.com

Dedication

This book is dedicated to all of my family; my mother Jane Conklin; my sister


Catherine Attaway; my brother Banks Attaway; my stepmother Robyn Attaway;
and my husband Ted de Winter.

https://www.yakibooki.com/download/matlab-a-practical-introduction-to-programming-and-problem-solving-5th-edition/
This Book is Available on YakiBooki.com

Preface

MOTIVATION
The purpose of this book is to teach basic programming concepts and skills
needed for basic problem solving, all using MATLAB® as the vehicle. MATLAB
is a powerful software package that has built-in functions to accomplish a
diverse range of tasks, from mathematical operations to three-dimensional
imaging. Additionally, MATLAB has a complete set of programming constructs
that allows users to customize programs to their own specifications.
There are many books that introduce MATLAB. There are two basic flavors of
these books: those that demonstrate the use of the built-in functions in
MATLAB, with a chapter or two on some programming concepts, and those that
cover only the programming constructs without mentioning many of the built-
in functions that make MATLAB efficient to use. Someone who learns just the
built-in functions will be well-prepared to use MATLAB, but would not under-
stand basic programming concepts. That person would not be able to then
learn a language such as C ++ or Java without taking another introductory
course, or reading another book, on the programming concepts. Conversely,
anyone who learns only programming concepts first (using any language)
would tend to write highly inefficient code using control statements to solve
problems, not realizing that in many cases these are not necessary in MATLAB.
Instead, this book takes a hybrid approach, introducing both the programming
and the efficient uses. The challenge for students is that it is nearly impossible to
predict whether they will in fact need to know programming concepts later on
or whether a software package such as MATLAB will suffice for their careers.
Therefore, the best approach for beginners is to give them both: the program-
ming concepts and the efficient built-in functions. Since MATLAB is very easy to
use, it is a perfect platform for this approach of teaching programming and
problem solving.
As programming concepts are critically important to this book, emphasis is not
placed on the time-saving features that evolve with every new MATLAB release.
xi

https://www.yakibooki.com/download/matlab-a-practical-introduction-to-programming-and-problem-solving-5th-edition/
This Book is Available on YakiBooki.com
xii Preface

For example, in most versions of MATLAB, statistics on variables are available


readily in the Workspace Window. This is not shown with any detail in the
book, as whether this feature is available depends on the version of the software
and because of the desire to explain the concepts in the book.

MODIFICATIONS IN FIFTH EDITION


The changes in the Fifth Edition of this book include the following.

n Use of MATLAB Version R2018a


n A revised Text Manipulation chapter, which includes manipulating
character vectors as well as the new string type
n Introduction to alternate MATLAB platforms, including MATLAB Mobile
n Local functions within scripts
n The new output format for most expression types
n Introduction to the RESTFUL web functions which import data from
websites
n Increased coverage of App Designer, which may eventually replace GUIs
and uses object-oriented programming
n Introduction to recording audio from a built-in device such as a
microphone
n Modified and new end-of-chapter exercises
n More coverage of data structures including categorical arrays and tables
n Increased coverage of built-in functions in MATLAB
n Modifications to symbolic math expressions

KEY FEATURES
Side-By-Side Programming Concepts and Built-In Functions
The most important and unique feature of this book is that it teaches program-
ming concepts and the use of the built-in functions in MATLAB, side-by-side. It
starts with basic programming concepts such as variables, assignments, input/
output, selection, and loop statements. Then, throughout the rest of the book,
many times a problem will be introduced and then solved using the “program-
ming concept” and also using the “efficient method.” This will not be done in every
case to the point that it becomes tedious, but just enough to get the ideas across.

Systematic Approach
Another key feature is that the book takes a very systematic, step-by-step
approach, building on concepts throughout the book. It is very tempting in
a MATLAB text to show built-in functions or features early on with a note that

https://www.yakibooki.com/download/matlab-a-practical-introduction-to-programming-and-problem-solving-5th-edition/
This Book is Available on YakiBooki.com
Preface xiii

says “we’ll do this later”. This book does not do that; functions are covered
before they are used in examples. Additionally, basic programming concepts
will be explained carefully and systematically. Very basic concepts such as loop-
ing to calculate a sum, counting in a conditional loop, and error-checking are
not found in many texts, but are covered here.

Data Transfer
Many applications in engineering and the sciences involve manipulating large
data sets that are stored in external files. Most MATLAB texts at least mention
the save and load functions, and in some cases, also some of the lower-level file
input/output functions. As file input and output is so fundamental to so many
applications, this book will cover several low-level file input/output functions,
as well as reading from and writing to spreadsheet files. Later chapters will also
deal with audio and image files. These file input/output concepts are introduced
gradually: first load and save in Chapter 3, then lower-level functions in
Chapter 9, and finally sound and images in Chapter 13. A brief introduction to
RESTFUL web functions, which import data from websites is given in Chapter 9.

User-Defined Functions
User-defined functions are a very important programming concept, and yet,
many times the nuances and differences between concepts such as types of
functions and function calls versus function headers can be very confusing
to beginning programmers. Therefore, these concepts are introduced gradually.
First, arguably the easiest types of functions to understand, those that calculate
and return one single value, are demonstrated in Chapter 3. Later, functions
that return no values and functions that return multiple values are introduced
in Chapter 6. Finally, advanced function features are shown in Chapter 10.

Advanced Programming Concepts


In addition to the basics, some advanced programming concepts such as text
manipulation, data structures (e.g., structures and cell arrays), recursion, anon-
ymous functions, and variable number of arguments to functions are covered.
Sorting and indexing are also addressed. All of these are again approached sys-
tematically; for example, cell arrays are covered before they are used in file input
functions and as labels on pie charts.

Problem-Solving Tools
In addition to the programming concepts, some basic mathematics necessary
for solving many problems will be introduced. These will include statistical
functions, solving sets of linear algebraic equations, and fitting curves to data.

https://www.yakibooki.com/download/matlab-a-practical-introduction-to-programming-and-problem-solving-5th-edition/
This Book is Available on YakiBooki.com
xiv Preface

The use of complex numbers and some calculus (integration and differentia-
tion) will also be introduced. The built-in functions in MATLAB to perform
these tasks will be described.

Plots, Imaging, and Graphical User Interfaces


Simple two-dimensional plots are introduced very early in the book
(Chapter 3) so that plot examples can be used throughout. A separate chapter,
Chapter 12, shows more plot types and demonstrates customizing plots and
how the graphics properties are handled in MATLAB. This chapter makes use
of text and cell arrays to customize labels. Also, there is an introduction to
image processing and the basics necessary to understand programming Graph-
ical User Interfaces (GUIs) in Chapter 13. App Designer, which creates GUIs
using object-oriented code, is also introduced in Chapter 13.

Vectorized Code
Efficient uses of the capabilities of the built-in operators and functions in
MATLAB are demonstrated throughout the book. In order to emphasize the
importance of using MATLAB efficiently, the concepts and built-in functions
necessary for writing vectorized code are treated very early in Chapter 2. Tech-
niques such as preallocating vectors and using logical vectors are then covered
in Chapter 5 as alternatives to selection statements and looping through vectors
and matrices. Methods of determining how efficient the code is are also covered.

Object-Oriented Programming
Creating objects and classes in MATLAB has been an option for some time, but
as of R2014b, all Graphics objects are truly objects. Thus, object-oriented
programming (OOP) is now a very important part of MATLAB programming.
Applications using App Designer reinforce the concepts.

LAYOUT OF TEXT
This text is divided into two parts: the first part covers programming constructs
and demonstrates the programming method versus efficient use of built-in
functions to solve problems. The second part covers tools that are used for basic
problem solving, including plotting, image processing, and techniques to solve
systems of linear algebraic equations, fit curves to data, and perform basic sta-
tistical analyses. The first six chapters cover the very basics in MATLAB and in
programming and are all prerequisites for the rest of the book. After that, many
chapters in the problem-solving section can be introduced when desired, to

https://www.yakibooki.com/download/matlab-a-practical-introduction-to-programming-and-problem-solving-5th-edition/
This Book is Available on YakiBooki.com
Preface xv

produce a customized flow of topics in the book. This is true to an extent,


although the order of the chapters has been chosen carefully to ensure that
the coverage is systematic.
The individual chapters are described here, as well as which topics are required
for each chapter.

PART 1: INTRODUCTION TO PROGRAMMING USING


MATLAB
Chapter 1: Introduction to MATLAB begins by covering the MATLAB Desktop
Environment. Variables, assignment statements, and types are introduced.
Mathematical and relational expressions and the operators used in them are
covered, as are characters, random numbers, and the use of built-in functions
and the Help browser.
Chapter 2: Vectors and Matrices introduces creating and manipulating vectors
and matrices. Array operations and matrix operations (such as matrix multipli-
cation) are explained. The use of vectors and matrices as function arguments
and functions that are written specifically for vectors and matrices are covered.
Logical vectors and other concepts useful in vectorizing code are emphasized in
this chapter.
Chapter 3: Introduction to MATLAB Programming introduces the idea of
algorithms and scripts. This includes simple input and output, and comment-
ing. Scripts are then used to create and customize simple plots and to do file
input and output. Finally, the concept of a user-defined function is introduced
with only the type of function that calculates and returns a single value.
Chapter 4: Selection Statements introduces the use of logical expressions in
if statements, with else and elseif clauses. The switch statement is also demon-
strated, as is the concept of choosing from a menu. Also, functions that return
logical true or false are covered.
Chapter 5: Loop Statements and Vectorizing Code introduces the concepts of
counted (for) and conditional (while) loops. Many common uses such as sum-
ming and counting are covered. Nested loops are also introduced. Some more
sophisticated uses of loops such as error-checking and combining loops and
selection statements are also covered. Finally, vectorizing code, by using
built-in functions and operators on vectors and matrices instead of looping
through them, is demonstrated. Tips for writing efficient code are emphasized,
and tools for analyzing code are introduced.
The concepts in the first five chapters are assumed throughout the rest of
the book.

https://www.yakibooki.com/download/matlab-a-practical-introduction-to-programming-and-problem-solving-5th-edition/

You might also like