(Ebook PDF) Matlab An Introduction With Applications 5Th Edition
(Ebook PDF) Matlab An Introduction With Applications 5Th Edition
com
https://ebookluna.com/product/ebook-pdf-matlab-an-
introduction-with-applications-5th-edition/
OR CLICK HERE
DOWLOAD NOW
https://ebookluna.com/product/ebook-pdf-matlab-an-introduction-with-
applications-6th/
ebookluna.com
https://ebookluna.com/product/numerical-methods-in-engineering-with-
matlab-3rd-edition/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-matlab-for-engineering-
applications-4th-edition/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-discrete-mathematics-with-
applications-5th-edition/
ebookluna.com
Foundations of Computational Finance with MATLAB (eBook
PDF)
https://ebookluna.com/product/foundations-of-computational-finance-
with-matlab-ebook-pdf/
ebookluna.com
https://ebookluna.com/download/matlab-for-engineering-
applications-5e-ise-ebook-pdf/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-living-ethics-an-introduction-
with-reading/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-environmental-ethics-an-
introduction-with-readings/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-fundamentals-of-
electromagnetics-with-matlab-2nd-edition/
ebookluna.com
vi Preface
I hope that the book will be useful and will help the users of MATLAB to
enjoy the software.
Amos Gilat
Columbus, Ohio
November, 2013
gilat. l @osu.edu
Introduction 1
Index 401
Introduction
Topics Covered
MATLAB is a huge program, and therefore it is impossible to cover all of it in one
book. This book focuses primarily on the foundations of MATLAB. The
1
2 Introduction
assumption is that once these foundations are well understood, the student will be
able to learn advanced topics easily by using the information in the Help menu.
The order in which the topics are presented in this book was chosen
carefully, based on several years of experience in teaching MATLAB in an
introductory engineering course. The topics are presented in an order that allows
the student to follow the book chapter after chapter. Every topic is presented
completely in one place and then used in the following chapters.
The first chapter describes the basic structure and features of MATLAB and
how to use the program for simple arithmetic operations with scalars as with a
calculator. Script files are introduced at the end of the chapter. They allow the
student to write, save, and execute simple MATLAB programs. The next two
chapters are devoted to the topic of arrays. MATLAB's basic data element is an
array that does not require dimensioning. This concept, which makes MATLAB a
very powerful program, can be a little difficult to grasp for students who have only
limited knowledge of and experience with linear algebra and vector analysis. The
concept of arrays is introduced gradually and then explained in extensive detail.
Chapter 2 describes how to create arrays, and Chapter 3 covers mathematical
operations with arrays.
Following the basics, more advanced topics that are related to script files
and input and output of data are presented in Chapter 4. This is followed by
coverage of two-dimensional plotting in Chapter 5. Programming with MATLAB
is introduced in Chapter 6. This includes flow control with conditional statements
and loops. User-defmed functions, anonymous functions, and function functions
are covered next in Chapter 7. The coverage of function files (user-defmed
functions) is intentionally separated from the subject of script files. This has
proven to be easier to understand by students who are not familiar with similar
concepts from other computer programs.
The next three chapters cover more advanced topics. Chapter 8 describes
how MATLAB can be used for carrying out calculations with polynomials, and
how to use MATLAB for curve fitting and interpolation. Chapter 9 covers
applications of MATLAB in numerical analysis. It includes solving nonlinear
equations, finding minimum or a maximum of a function, numerical integration,
and solution of first-order ordinary differential equations. Chapter 10 describes
how to produce three-dimensional plots, an extension of the chapter on two
dimensional plots. Chapter 11 covers in great detail how to use MATLAB in
symbolic operations.
In every chapter the topics are introduced gradually in an order that makes the
concepts easy to understand. The use of MATLAB is demonstrated extensively
within the text and by examples. Some of the longer examples in Chapters 1-3 are
titled as tutorials. Every use of MATLAB is printed with a different font and with
a gray background. Additional explanations appear in boxed text with a white
background. The idea is that the reader will execute these demonstrations and
Introduction 3
Symbolic Calculations
The MATLAB program, like most other software, is continually being developed
and new versions are released frequently. This book covers MATLAB Version
8.2.0.701, Release 2013b. It should be emphasized, however, that the book covers
the basics of MATLAB, which do not change much from version to version. The
book covers the use of MATLAB on computers that use the Windows operating
system. Everything is essentially the same when MATLAB is used on other
machines. The user is referred to the documentation of MATLAB for details on
using MATLAB on other operating systems. It is assumed that the software is
installed on the computer, and the user has basic knowledge of operating the
computer.
It is probably impossible to write a textbook where all the subjects are presented
in an order that is suitable for everyone. The order of topics in this book is such
that the fundamentals ofMATLAB are covered first (arrays and array operations),
and, as mentioned before, every topic is covered completely in one location,
which makes the book easy to use as a reference. The order of the topics in this
fifth edition is the same as in the previous edition. Programming is introduced
before user-defmed functions. This allows using programming in user-defmed
functions. Also, applications ofMATLAB in numerical analysis follow Chapter 8
which covers polynomials, curve fitting, and interpolation.
Chapterl
Starting with
MATLAB
This chapter begins by describing the characteristics and purpose of the different
windows in MATLAB. Next, the Command Window is introduced in detail. The
chapter shows how to use MATLAB for arithmetic operations with scalars in
much to the way that a calculator is used. This includes the use of elementary
math functions with scalars. The chapter then shows how to define scalar vari
ables (the assigmnent operator) and how to use these variables in arithmetic calcu
lations. The last section in the chapter introduces script files. It shows how to
write, save, and execute simple MATLAB programs.
It is assumed that the software is installed on the computer, and that the user can
start the program. Once the program starts, the MATLAB desktop window opens
with the default layout, Figure 1-1. The layout has a Toolstrip at the top, the Cur
rent Folder Toolbar below it, and four windows underneath. At the top of the
Toolstrip there are three tabs: HOME, PLOTS, and APPS. Clicking on the tabs
changes the icons in the Toolstrip. Commonly, MATLAB is used with the HOME
tab selected. The associated icons are used for executing various commands, as
explained later in this chapter. The PLOTS tab can be used to create plots, as
explained in Chapter 5 (Section 5.12), and the APPS tab can be used for opening
additional applications and Toolboxes of MATLAB.
5
6 Chapter 1: Startin.: with MATLAB
(ommandWindow ® Worlupace
CommandHistory @
· ·ls-- 10/2/2013 3:01 PM --
are briefly described on the following pages. More detailed descriptions are
included in the chapters where they are used. The Command History Window,
Current Folder Window, and the Workspace Window are described in Sections
1.2, 1.8.4, and 4.1, respectively.
Command Window: The Command Window is MATLAB 's main window and
opens when MATLAB is started. It is convenient to have the Command Window
as the only visible window. This can be done either by closing all the other win
dows, or by selecting Command Window Only in the menu that opens when the
Layout icon on the Toolstrip is selected. To close a window, click on the pull
down menu at the top right-hand side of the window and then select Close. Work
ing in the Command Window is described in detail in Section 1.2.
Window Purpose
Window Purpose
Figure Window: The Figure Window opens automatically when graphics com
mands are executed, and contains graphs created by these commands. An example
of a Figure Window is shown in Figure 1-2. A more detailed description of this
window is given in Chapter 5.
IJ Figur� 1
file ,Edit Yiew Insert Iools. Q.esktop Window Help
30
20
1
0
-10
- 20
-30
-40
-so o'-----
-- -----'---------'---
" ------
-- -'---------'-----
-- -:'::-1o 1 -
2L
---,-
----
-:'::-14 ---6
----
1"
2 4
____
Editor Window: The Editor Window is used for writing and editing programs.
This window is opened by clicking on the New Script icon in the Toolstrip, or by
clicking on the New icon and then selecting Script from the menu that opens. An
example of an Editor Window is shown in Figure 1-3.More details on the Editor
Window are given in Section 1.8.2, where it is used for writing script files, and in
Chapter 7, where it is used to write function files.
Help Window: The Help Window contains help information. This window can
be opened from the Help icon in the Toolstrip of the Command Window or the
toolbar of any MATLAB window. The Help Window is interactive and can be
used to obtain information on any feature ofMATLAB. Figure 1-4 shows an open
Help Window.
When MATLAB is started for the first time, the screen looks like that shown
in Figure 1-1. For most beginners it is probably more convenient to close all the
8 Chapter 1: Startin.: with MATLAB
r- !3 Editor- Unt:itledJ*
Find Files
Ul [) &> � � Run Section
EDIT NAVIGATE Breakpoints Ru n Run and Run and =
Advance
Prin t . nne Advance
DIS=sqrt (b"2-4iira'"'c);
�(-b+di3) I (2"'"a)
x1�(-b-dis)/(2'a)
�' Help
... �
.,
> Mathematics
file:/1/C:/Proqram F11es/MATLAB/R2013b/help/matlab/relea<e-note<.html
windows except the Command Window. The closed windows can be reopened by
selecting them from the layout icon in the Toolstrip. The windows shown in Fig
ure 1-1 can be displayed by clicking on the layout icon and selecting Default in
the menu that opens. The various windows in Figure 1-1 are docked to the desk
top. A window can be undocked (become a separate, independent window) by
dragging it out. An independent window can be redocked by clicking on the pull
down menu at the top right-hand side of the window and then selecting Dock.
The Command Window is MATLAB's main window and can be used for execut
ing commands, opening other windows, running programs written by the user, and
managing the software. An example of the Command Window, with several sim
ple commands that will be explained later in this chapter, is shown in Figure 1-5 .
• Once a command is typed and the Enter key is pressed, the command is executed.
However, only the last command is executed. Everything executed previously
(that might be still displayed) is unchanged.
• Several commands can be typed in the same line. This is done by typing a comma
between the commands. When the Enter key is pressed, the commands are exe
cuted in order from left to right.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.