0% found this document useful (0 votes)
9 views39 pages

(Ebook PDF) Matlab An Introduction With Applications 5Th Edition

The document provides information on various MATLAB eBooks available for download, including titles like 'MATLAB An Introduction with Applications' and 'Numerical Methods in Engineering with MATLAB'. It emphasizes the utility of MATLAB for technical computing and its relevance in academic and industrial settings. The content also outlines the structure of a specific MATLAB textbook aimed at beginners with no prior programming experience, detailing the topics covered and the book's purpose as a learning resource.

Uploaded by

awunghideg
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)
9 views39 pages

(Ebook PDF) Matlab An Introduction With Applications 5Th Edition

The document provides information on various MATLAB eBooks available for download, including titles like 'MATLAB An Introduction with Applications' and 'Numerical Methods in Engineering with MATLAB'. It emphasizes the utility of MATLAB for technical computing and its relevance in academic and industrial settings. The content also outlines the structure of a specific MATLAB textbook aimed at beginners with no prior programming experience, detailing the topics covered and the book's purpose as a learning resource.

Uploaded by

awunghideg
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/ 39

Get the full ebook with Bonus Features for a Better Reading Experience on ebookluna.

com

(eBook PDF) MATLAB An Introduction with


Applications 5th Edition

https://ebookluna.com/product/ebook-pdf-matlab-an-
introduction-with-applications-5th-edition/

OR CLICK HERE

DOWLOAD NOW

Download more ebook instantly today at https://ebookluna.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

(eBook PDF) MATLAB An Introduction with Applications 6th

https://ebookluna.com/product/ebook-pdf-matlab-an-introduction-with-
applications-6th/

ebookluna.com

Numerical Methods in Engineering with MATLAB 3rd Edition

https://ebookluna.com/product/numerical-methods-in-engineering-with-
matlab-3rd-edition/

ebookluna.com

(eBook PDF) MATLAB for Engineering Applications 4th


Edition

https://ebookluna.com/product/ebook-pdf-matlab-for-engineering-
applications-4th-edition/

ebookluna.com

(eBook PDF) Discrete Mathematics with Applications 5th


Edition

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

MATLAB for Engineering Applications, 5e ISE 5th/ISE


Edition William J. Palm Iii - eBook PDF

https://ebookluna.com/download/matlab-for-engineering-
applications-5e-ise-ebook-pdf/

ebookluna.com

(eBook PDF) Living Ethics: An Introduction with Reading

https://ebookluna.com/product/ebook-pdf-living-ethics-an-introduction-
with-reading/

ebookluna.com

(eBook PDF) Environmental Ethics: An Introduction with


Readings

https://ebookluna.com/product/ebook-pdf-environmental-ethics-an-
introduction-with-readings/

ebookluna.com

(eBook PDF) Fundamentals of Electromagnetics with MATLAB


2nd Edition

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

To my parents Schoschana and Haim Gelbwacks


Contents
Preface v

Introduction 1

Chapter 1 Starting with MATLAB 5


1.1 STARTING MATLAB, MATLAB WINDOWS 5
1.2 WORKING IN THE COMMAND WINDOW 9
1.3 ARITHMETIC OPERATIONS WITH SCALARS 11
1.3.1 Order of Precedence 11
1.3.2 Using MATLAB as a Calculator 12
1.4 DISPLAY FORMATS 12
1.5 ELEMENTARYMATH BUILT-IN FUNCTIONS 14
1.6 DEFINING SCALAR VARIABLES 16
1.6.1 The Assignment Operator 16
1.6.2 Rules About Variable Names 18
1.6.3 Predefined Variables and Keywords 19
1.7 USEFUL COMMANDS FORMANAGING VARIABLES 19
1.8 SCRIPT FILES 20
1.8.1 Notes About Script Files 20
1.8.2 Creating and Saving a Script File 21
1.8.3 Running (Executing) a Script File 22
1.8.4 Current Folder 22
1.9 EXAMPLES OF MATLAB APPLICATIONS 24
1.10 PROBLEMS 27

Chapter 2 Creating Arrays 35


2.1 CREATING A ONE-DIMENSIONAL ARRAY (VECTOR) 35
2.2 CREATING A TwO-DIMENSIONAL ARR AY (MATRIX) 39
2.2.1 The zeros, ones and, eye Commands 40
2.3 NOTES ABOUT VARIABLES IN MATLAB 41
2.4 THE TRANSPOSE OPERATOR 41
2.5 ARRAY ADDRESSING 42
2.5.1 Vector 42
2.5.2 Matrix 43
2.6 USING A COLON : IN ADDRESSING ARRAYS 44
2.7 ADDING ELEMENTS TO EXISTING VARIABLES 46
2.8 DELETING ELEMENTS 48
2.9 BUILT-IN FUNCTIONS FOR HANDLING ARR AYS 49
2.10 STRINGS AND STRINGS AS VARIABLES 53
2.11 PROBLEMS 55

Chapter 3 Mathematical Operations with Arrays 63


3.1 ADDITION AND SUBTRACTION 64
3.2 ARRAYMULTIPLICATION 65
3.3 ARRAY DIVISION 68
vii
viii Contents

3.4 ELEMENT-BY-ELEMENT OPERATIONS 72


3.5 USING ARRAYS IN MATLAB BUILT-IN MATH FUNCTIONS 75
3.6 BUILT-IN FUNCTIONS FOR ANALYZING ARRAYS 75
3.7 GENERATION OF RANDOM NUMBERS 77
3.8 EXAMPLES OF MATLAB APPLICATIONS 80
3.9 PROBLEMS 86

Chapter 4 Using Script Files and Managing Data 95


4.1 THE MATLAB WORKSPACE AND THE WORKSPACE WINDOW 96
4.2 INPUT TO A SCRIPT FILE 97
4.3 OUTPUT COMMANDS 100
4.3.1 The disp Command 101
4.3.2 The fprintf Command 103
4.4 THE save AND load COMMANDS 111
4.4.1 The save Command 111
4.4.2 The load Command 112
4.5 IMPORTING AND EXPORTING DATA 114
4.5.1 Commands for Importing and Exporting Data 114
4.5.2 Using the Import Wizard 116
4.6 EXAMPLES OF MATLAB APPLICATIONS 118
4.7 PROBLEMS 123

Chapter 5 Two-Dimensional Plots 133


5.1 THE plot COMMAND 134
5.1.1 Plot of Given Data 138
5.1.2 Plot of a Function 139
5.2 THE fplot COMMAND 140
5.3 PLOTTING MULTIPLE GRAPHS IN THE SAME PLOT 141
5.3.1 Using the plot Command 141
5.3.2 Using the hold on and hold off Commands 142
5.3.3 Using the line Command 143
5.4 FORMATTING A PLOT 144
5.4.1 Formatting a Plot Using Commands 144
5.4.2 Formatting a Plot Using the Plot Editor 148
5.5 PLOTS WITH LOGARITHMIC AxES 149
5.6 PLOTS WITH ERROR BARS 150
5.7 PLOTS WITH SPECIAL GRAPHICS 152
5.8 HISTOGRAMS 153
5.9 POLAR PLOTS 156
5.10 PuTTING MULTIPLE PLOTS ON THE SAME PAGE 157
5.11 MULTIPLE FIGURE WINDOWS 157
5.12 PLOTTING USING THE PLOTS TOOLSTRIP 159
5.13 EXAMPLES OF MATLAB APPLICATIONS 160
5.14 PROBLEMS 165
Contents ix

Chapter 6 Programming in MATLAB 175


6.1 RELATIONAL AND LOGICAL OPERATORS 176
6.2 CONDITIONAL STATEMENTS 184
6.2.1 The if-end Structure 184
6.2.2 The if-else-end Structure 186
6.2.3 The if-elseif-else-end Structure 187
6.3 THE switch-case STATEMENT 189
6.4 LOOPS 192
6.4.1 for-end Loops 192
6.4.2 while-end Loops 197
6.5 NESTED LOOPS AND NESTED CONDITIONAL STATEMENTS 200
6.6 THE break AND continue COMMANDS 202
6.7 EXAMPLES OF MATLAB APPLICATIONS 203
6.8 PROBLEMS 211

Chapter 7 User-Defined Functions and Function Files 221


7.1 CREATING A FUNCTION FILE 222
7.2 STRUCTURE OF A FUNCTION FILE 223
7.2.1 Function Definition Line 224
7.2.2 Input and Output Arguments 224
7.2.3 The H1 Line and Help Text Lines 226
7.2.4 Function Body 226
7.3 LOCAL AND GLOBAL VARIABLES 226
7.4 SAVING A FUNCTION FILE 227
7.5 USING A USER-DEFINED FUNCTION 228
7.6 EXAMPLES OF SIMPLE USER-DEFINED FUNCTIONS 229
7.7 COMPARISON BETWEEN SCRIPT FILES AND FUNCTION FILES 231
7.8 ANONYMOUS FUNCTIONS 231
7.9 FUNCTION FUNCTIONS 234
7.9.1 Using Function Handles forPassing a Function into a Function
Function 235
7.9.2 Using a Function Name forPassing a Function into a Function
Function 238
7.10 SUBFUNCTIONS 240
7.11 NESTED FUNCTIONS 242
7.12 EXAMPLES OF MATLAB APPLICATIONS 245
7.13 PROBLEMS 248

Chapter 8 Polynomials, Curve Fitting, and Interpolation 261


8.1 POLYNOMIALS 261
8.1.1 Value of aPolynomial 262
8.1.2 Roots of aPolynomial 263
8.1.3 Addition, Multiplication, and Division ofPolynomials 264
8.1.4 Derivatives ofPolynomials 266
8.2 CURVE FITTING 267
8.2.1 Curve Fitting withPolynomials; The polyfit Function 267
8.2.2 Curve Fitting with Functions Other thanPolynomials 271
x Contents

8.3 INTERPOLATION 274


8.4 THE BASIC FITTING INTERFACE 278
8.5 EXAMPLES OF MATLAB APPLICATIONS 281
8.6 PROBLEMS 286

Chapter 9 Applications in Numerical Analysis 295


9.1 SOLVING AN EQUATION WITH ONE VARIABLE 295
9.2 FINDING A MINIMUM OR A MAXIMUM OF A FUNCTION 298
9.3 NUMERICAL INTEGRATION 300
9.4 ORDINARY DIFFERENTIAL EQUATIONS 303
9.5 EXAMPLES OF MATLAB APPLICATIONS 307
9.6 PROBLEMS 313

Chapter 10 Three-Dimensional Plots 323


10.1 LINE PLOTS 323
10.2 MESH AND SURFACE PLOTS 324
10.3 PLOTS WITH SPECIAL GRAPHICS 331
10.4 THE view COMMAND 333
10.5 EXAMPLES OF MATLAB APPLICATIONS 336
10.6 PROBLEMS 341

Chapter 11 Symbolic Math 347


11.1 SYMBOLIC OBJECTS AND SYMBOLIC EXPRESSIONS 348
11.1.1 Creating Symbolic Objects 348
11.1.2 Creating Symbolic Expressions 350
11.1.3 The fmdsym Command and the Default Symbolic
Variable 353
11.2 CHANGING THE FORM OF AN EXISTING SYMBOLIC EXPRESSION 354
11.2.1 The collect, expand, and factor Commands 354
11.2.2 The simplify and simple Commands 356
11.2.3 The pretty Command 357
11.3 SOLVING ALGEBRAIC EQUATIONS 358
11.4 DIFFERENTIATION 363
11.5 INTEGRATION 365
11.6 SOLVING AN ORDINARY DIFFERENTIAL EQUATION 366
11.7 PLOTTING SYMBOLIC EXPRESSIONS 369
11.8 NUMERICAL CALCULATIONS WITH SYMBOLIC EXPRESSIONS 372
11.9 EXAMPLES OF MATLAB APPLICATIONS 376
11.10 PROBLEMS 384

Appendix: Summary of Characters, Commands, and


Functions 393

Answers to Selected Problems www.wiley.com/college/gilat

Index 401
Introduction

MATLAB is a powerful language for technical computing. The name MATLAB


stands for MATrix LABoratory, because its basic data element is a matrix (array).
MATLAB can be used for math computations, modeling and simulations, data
analysis and processing, visualization and graphics, and algorithm development.
MATLAB is widely used in universities and colleges in introductory and
advanced courses in mathematics, science, and especially engineering. In industry
the software is used in research, development, and design. The standard
MATLAB program has tools (functions) that can be used to solve common
problems. In addition, MATLAB has optional toolboxes that are collections of
specialized programs designed to solve specific types of problems. Examples
include toolboxes for signal processing, symbolic calculations, and control
systems.
Until recently, most of the users of MATLAB have been people with
previous knowledge of programming languages such as FORTRAN and C who
switched to MATLAB as the software became popular. Consequently, the
majority of the literature that has been written about MATLAB assumes that the
reader has knowledge of computer programming. Books about MATLAB often
address advanced topics or applications that are specialized to a particular field.
Today, however, MATLAB is being introduced to college students as the first (and
often the only) computer program they will learn. For these students there is a
need for a book that teaches MATLAB assuming no prior experience in computer
programming.

The Purnose of This Book

MATLAB: An Introduction with Applications is intended for students who are


using MATLAB for the first time and have little or no experience in computer
programming. It can be used as a textbook in freshmen engineering courses or in
workshops where MATLAB is being taught. The book can also serve as a
reference in more advanced science and engineering courses where MATLAB is
used as a tool for solving problems. It also can be used for self-study ofMATLAB
by students and practicing engineers. In addition, the book can be a supplement or
a secondary book in courses where MATLAB is used but the instructor does not
have the time to cover it extensively.

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.

The Framework of a '[mical Chapter

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

tutorials in order to gain experience in usingMATLAB. In addition, every chapter


includes formal sample problems that are examples of applications of MATLAB
for solving problems in math, science, and engineering. Each example includes a
problem statement and a detailed solution. Some sample problems are presented
in the middle of the chapter. All of the chapters (except Chapter 2) have a section
at the end with several sample problems of applications. It should be pointed out
that problems withMATLAB can be solved in many different ways. The solutions
of the sample problems are written such that they are easy to follow. This means
that in many cases the problem can be solved by writing a shorter, or sometimes
"trickier," program. The students are encouraged to try to write their own solu­
tions and compare the end results. At the end of each chapter there is a set of
homework problems. They include general problems from math and science and
problems from different disciplines of engineering.

Symbolic Calculations

MATLAB is essentially a software for numerical calculations. Symbolic math


operations, however, can be executed if the Symbolic Math toolbox is installed.
The Symbolic Math toolbox is included in the student version of the software and
can be added to the standard program.

Software and Hardware

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.

T he Order of Topics in the Book

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.

1.1 STARTING MATLAB, MATLAB WINDOWS

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.

The default layout


The default layout (Figure 1-1) consists of the following four windows that are
displayed under the Toolstrip: the Command Window (larger window at the cen­
ter), the Current Folder Window (on the left) and the Workspace and Command
History windows (on the right). A list of several MATLAB windows and their
purposes is given in Table 1-1.
Four of the windows-the Command Window, the Figure Window, the Editor
Window, and the Help Window-are used extensively throughout the book and

5
6 Chapter 1: Startin.: with MATLAB

, ..;. MATl.AB R20Bb


.� ..
Clsw:tdlWI'll»ws .. ®I Starch Documentation

(]> An11lyze cooe


db m a;,, Open Vlll'l!ltlole ,..
<ow"'"'"
UEl III
£ir.RunandTrne
@Preferences

r«rw New Open hiport s.r.ve Laywt �tPath


Script • ..,. 011111 W!llb{wlce ClearWortspllr: e '9' " Cle.!lrCo!Tinllnds ,...

• + [J'] �11M � C: � U�m � gilat1 • Document� • MATLAB.

(ommandWindow ® Worlupace

D Name- Name .a. Value

CommandHistory @
· ·ls-- 10/2/2013 3:01 PM --

Figure 1-1: The default view ofMATLAB desktop.

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.

Table 1-1: MATLAB windows

Window Purpose

Command Window Main window, enters variables, runs


programs.

Figure Window Contains output from graphic


commands.

Editor Window Creates and debugs script and


function files.

Help Window Provides help information.

Command History Window Logs commands entered in the


Command Window.
1.1 Starting MATLAB. MATLAB Windows 7

Table 1-1: MATLAB windows

Window Purpose

Workspace Window Provides information about the


variables that are stored.

Current Folder Window Shows the files in the current folder.

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

Plot of the function y�1 4cos(x)


40 �--�----�--��-

30

20
1
0

-10

- 20

-30

-40
-so o'-----
-- -----'---------'---
" ------
-- -'---------'-----
-- -:'::-1o 1 -
2L
---,-
----
-:'::-14 ---6
----
1"
2 4
____

Figure 1-2: Example of a Figure Window.

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*

EDrTOR PUBLISH VIEW

Find Files
Ul [) &> � � Run Section
EDIT NAVIGATE Breakpoints Ru n Run and Run and =
Advance
Prin t . nne Advance

Example of a script file.


This program calculates the roots of a quadratic equation:
� a�x�2 + b�x +c = 0

a-�; b--9; c--17.5;

DIS=sqrt (b"2-4iira'"'c);

�(-b+di3) I (2"'"a)
x1�(-b-dis)/(2'a)

Figure 1-3: Example of an Editor Window.

�' Help

... �

Contents Search Documentation


Docurnerrtalion Cer.ler

.,

> Getting Started wilh MATl.AB


MATLAB
Examples
GeHing Started Examples Release No1es
Release Notes
Functions
> Language Fundamentals
> Language Fundamentals SyrJta,;, opera!OJs, data types, array irKfexing aOO m.:mipul.alioo

> Mathematics

> Grapllics > Mathematics


> Programmi ng Scripls and Functions UneM algebra. basic statistics, differentiation aOO integrals, Fourier

> Data and File Management tr.:msforrns, -arKI other mathematics

> GUI Building

> Advanced Software Development > Graphics


> De5ktop Environmenl Two- alllf three-dimensiooal plol.s, dala exploration and visualiz.alion

techniques, images, printing, arK! graphics objects

> Programming Scripts and Functions


Program Iiies, control now, edltir�g, debugging

> Data and File Management


Data import and exp<Ht, wort.space, li!€5 and folders

> GUI Building


Application development usillQ GUIDE alld callbac:ks

> Advanced Software Development


Objecl-orienled programming; code performance; unit testing; mterfaces to
Java"', CIC+t-, .NET and other la�uage:s

file:/1/C:/Proqram F11es/MATLAB/R2013b/help/matlab/relea<e-note<.html

Figure 1-4: The Help Window.


1.2 Working in the Command Window 9

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.

1.2 WORKING IN THE COMMAND WINDOW

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 .

..JJ. MA.TlAB R2013b

HOME PLOTS APPS

New New Open ]= CofTllare rnport Save Layout Se!Path


Scr'p: .. om WorKspace Add-OM •

+• rn � I � C: � Users � gil.rtl ,. Doc:uments � MATLAB


>> 2"" (1+3}

To type a command the cursor is placed


next to the command prompt ( >> ).

Figure 1-5: The Command Window.

Notes for working in the Command Window:


• To type a command, the cursor must be placed next to the command prompt ( >> ).

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

• It is not possible to go back to a previous line that is displayed in the Command


Window, make a correction, and then re-execute the command.
Exploring the Variety of Random
Documents with Different Content
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.

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. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning
of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the Project
Gutenberg™ License.

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.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• 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 provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for


the “Right of Replacement or Refund” described in paragraph 1.F.3,
the Project Gutenberg Literary Archive Foundation, the owner of the
Project Gutenberg™ trademark, and any other party distributing a
Project Gutenberg™ electronic work under this agreement, disclaim
all liability to you for damages, costs and expenses, including legal
fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR
NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR
BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK
OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL
NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF
YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving
it, you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or
entity that provided you with the defective work may elect to provide
a replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.

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.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,


the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

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.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.
Project Gutenberg™ eBooks are often created from several printed
editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.
back
back
back
back
back
back
back

You might also like