اسم المؤلف
Jim Sizemore and John Paul Mueller
التاريخ
22 يناير 2021
المشاهدات
435
التقييم
(لا توجد تقييمات)

MATLAB for Dummies
by Jim Sizemore and John Paul Mueller
Contents at a Glance
Introduction 1
Part I: Getting Started With MATLAB 5
Chapter 1: Introducing MATLAB and Its Many Uses .7
Chapter 2: Starting Your Copy of MATLAB 19
Chapter 3: Interacting with MATLAB 37
Chapter 4: Starting, Storing, and Saving MATLAB Files 59
Part II: Manipulating and Plotting Data in MATLAB 79
Chapter 5: Embracing Vectors, Matrices, and Higher Dimensions .81
Chapter 6: Understanding Plotting Basics 115
Chapter 7: Using Advanced Plotting Features 135
Part III: Streamlining MATLAB . 151
Chapter 8: Automating Your Work 153
Chapter 9: Expanding MATLAB’s Power with Functions 171
Part IV: Employing Advanced MATLAB Techniques . 213
Chapter 11: Importing and Exporting Data .215
Chapter 12: Printing and Publishing Your Work 233
Chapter 13: Recovering from Mistakes .257
Part V: Specific MATLAB Applications 277
Chapter 14: Solving Equations and Finding Roots .279
Chapter 15: Performing Analysis .307
Chapter 16: Creating Super Plots .319
Part VI: The Part of Tens 351
Chapter 17: Top Ten Uses of MATLAB 353
Chapter 18: Ten Ways to Make a Living Using MATLAB .361
Appendix A: MATLAB Functions .367
Appendix B: MATLAB’s Plotting Routines 377
Index
dex
• A •
\a (alarm), 161
abs() function, 370
absolute breakpoint, 169
absolute rotation, 141
accessing
function browser, 52–54
MATLAB files, 72–75
multidimensional matrices, 102–103
acos() function, 52, 368
acosd() function, 368
acosh() function, 368
acot() function, 369
acotd() function, 369
acoth() function, 369
acsc() function, 369
acscd() function, 369
acsch() function, 369
activating MATLAB, 21–22
annotations to plots, 149
derivatives, 246–247
fractions, 243–244
icons to QAT, 23
integral, 246
math symbols, 243–247
matrices, 88–89
to plots, 125–127
square root, 244–245
steps to colon method, 87
sum, 245–246
titles to plots, 145–147
vectors, 88–89
toolbar), 28
248–251
alarm (\a), 161
comparing numeric and symbolic
algebra, 291–293
cubic and nonlinear equations, 294–295
interpolation, 295–296
analysis
calculus
differential, 312–313
integral, 313–314
multivariate, 314–315
linear algebra
determinants, 308
eigenvalues, 310–311
factorization, 311–312
reduction, 308–310
of scripts for errors, 169–170
solving differential equations
numerical approach, 316–317
symbolic approach, 317–318
angle distribution, displaying using
rose() function, 342–343
angle() function, 370
animation
movies, 346–347
objects, 347–348
annotation() function, 149
annotations, in plots, 148–150
anonymous functions, 191–192
ans constant, 40, 48
apostrophe (’), 49, 87–88
App option (Command window), 26
area() function, 133, 378386 MATLAB For Dummies
arguments, 39, 181, 186
arithmetic functions, 367–368
arrayfun() function, 373
asec() function, 369
asecd() function, 369
asech() function, 369
asin() function, 52, 368
asind() function, 368
asinh() function, 368
at (@) symbol, 192
atan() function, 52, 368
atan2() function, 368
atan2d() function, 368
atand() function, 368
atanh() function, 369
automation. See scripting
axes handles, getting, 143
axes labels, modifying, 144–145
axis
creating dates for using datetick()
function, 322–326
obtaining current using using gca()
function, 322
• B •
\b (backspace), 162
Back button (Current Folder toolbar),
27, 62
BackgroundColor property, 147
backslash (\), 161
backspace (\b), 162
backtrace, 264
bank command, 43
bar() function
for flat 3D plots, 136–140
procedures for, 142
bar3() function
for dimensional 3D plot, 140–142
procedures for, 142
bar3h() function
procedures for, 142
barh() function
procedures for, 142
BASIC (Beginner’s All-Purpose Symbolic
Instruction Code), 10
Basic value, 222
Beginner’s All-Purpose Symbolic
Instruction Code (BASIC), 10
benefits, of scripts, 154
blkdiag() function, 111
blog, for this book, 16
bold
using, 235–237
Boole, George (mathematician), 51
Boolean logic, 51–52
break clause, 207–208, 209
breakpoints, creating, 169
Browse for Folder button (Current Folder
toolbar), 28, 63
bsxfun() function, 91, 94, 95, 96, 97
bucky() function, 344
built-in functions
sending data in/getting data out,
177–178
• C •
C++, 61
calculating factorials, 202
calculator, using MATLAB as a, 38–44
calculus
differential, 312–313
integral, 313–314
multivariate, 314–315
calling scripts, 167–168
Cameron, James (explorer), 307
caret (^), 47, 242, 287
carriage return (r), 162
cart2pol() function, 371
cart2sph() function, 371
Cartesian functions, 371
case sensitivity
of MATLAB, 39
of variables, 49
cat() function, 101
catchError, 250
categories, of functions, 53
cause property, 260
C/C++ language, 13, 16Index 387
cd command, 67
CDC (Centers for Disease Control),
14, 363
ceil() function, 46, 368
cell arrays, using in matrices, 107–110
cell() function, 107
cell2mat() function, 226–228
Centers for Disease Control (CDC),
14, 363
char() function, 293
cheat sheet (website), 3
choosing layouts, 36
circumflex (^), 95–97
clc command, 39, 125
clc() function, 177
clf command, 125, 144
Clipboard, 70
closing windows, 34–35
codeToEvaluate, 250
colon (:)
creating ranges of values using, 86
multidimensional matrices and, 102
colon method, adding steps to, 87
color coding, 66
Color property, 147
colorbar() function, creating plots
with, 326–329
columns, importing, 224–225
comet() function, 377
comma (,), 84, 85
Command History
converting into scripts, 160
window, 23, 24, 25
Command window
changing formatting, 42–44
suppressing output, 44
typing commands in, 290–291
using, 24–27
commands
creating plots using, 117–119
defined, 39
exploring folders with, 65–69
format, 43–44
formatting text with
font, 234–241
special characters, 241–243
saving
figures to disk with, 252–253
with GUI, 77
as scripts, 31–33
using commands, 77–78
variables using, 77
typing, 24–25
typing in Command window, 290–291
using for user input, 158–159
comment out, 162
defined, 162
common fixes, for error messages,
267–268
compact command, 44
companion files, website for, 4
Compare Against option, 64
comparing
built-in functions and custom
functions, 179–180
numeric and symbolic algebra, 291–293
scripts and functions, 179
scripts with functions, 179
compass() function, 340–342, 379
complex() function, 370
complex numbers, 97–99, 370
computer chips, 364
computer skills, for MATLAB, 15
computers, how they work, 9–10
concatenation operator ([ ]), 159
cond() function, 308
conditional breakpoint, 169
coneplot() function, 383
configuring
output page, 253–255
plots, 130–132
conj() function, 370
constants, functions for, 371–372
contacting the authors, 58
continuation operator ( .), 160
continuing long strings, 160–162
contour() function, 382
contour3() function, 382
contourf() function, 382388 MATLAB For Dummies
control character, 161
converting
Command History into scripts, 160
between symbolic and numeric
data, 293
Copy option, 64
copyfile command, 67
copying
to Clipboard, 70
formulas, 41
and pasting, 70–71, 159–160
corrcoef() function, 300, 373
cos() function, 52, 368
cosd() function, 368
cosh() function, 368
cot() function, 369
cotd() function, 369
coth() function, 369
cov() function, 300, 373
Create Zip File option, 63
createThumbnail, 250
creating
axis dates using datetick()
function, 322–326
error messages
custom, 268–272
useful, 272–273
error-handling code, 170
exception code, 268–270
folders, 30–31
functions
comparing built-in functions and
custom functions, 179–180
comparing scripts and functions, 179
global variables, 187–188
nesting functions, 190
optional arguments, 186
passing data in, 184–185
passing data out, 185–187
subfunctions, 188–189
using new functions, 182–183
multidimensional matrices, 99–102
multiple plots in single commands
with plot() function, 124
plots
with colorbar() function, 326–329
using commands, 117–119
using Plots tab options, 120–122
using Workspace window, 119–120
powers of matrices, 95–97
pseudo-random numbers, 301
ranges of values using colons, 86
ranges of values using linspace()
function, 86–87
recursive functions, 201–205
scripts
continuing long strings, 160–162
converting Command History into
scripts, 160
copying and pasting into scripts, 159–160
using commands for user input, 158–159
speech recognition software, 363
storage lockers, 48–50
subplots, 128–130
variables, 49
warning messages, 262–264
cross() function, 372
csc() function, 369
cscd() function, 369
csch() function, 369
csvwrite() function, 75, 225, 226–228
Ctrl+C, 55, 70, 159
Ctrl+Click, 31
Ctrl+X, 159
cubic and nonlinear equations, 294–295
Cubic Equation Calculator (website), 295
curly braces ({}), 107, 242
current folder, changing, 28–30
Current Folder toolbar, 27–28
Current Folder window
viewing, 28–33
Curve Fitting Toolbox (website), 297
custom error messages, 268–272
CustomException() function, 270–272
Cut option, 64
cutting and pasting, 71–72Index 389
• D •
daspect() function, interacting with,
329–331
data
entering, 83–88
exporting. See exporting
finding deviations in using errorbar()
function, 334
importing. See importing
passing in, 184–185
passing out, 185–187
printing, 255
sending in/getting out, 177–178
showing distibution using stem()
function, 336–337
data formats, 75
datenum() function, 322
datetick() function, creating axis
dates using, 322–326
decision-making
if statement, 194–198, 201
switch statement, 199–201
default folder, changing, 30
defining
delimiter types, 223–224
variable names, 48–49
delete command, 67
Delete option, 64
deleting
icons from QAT, 23
plots, 128
delimiter
defined, 217
types, 223–224
Delimiter property, 228
Delimiter value, 221
descriptive statistics, 297–300
designing
computer chips, 364
equipment, 365
det() function, 373
Details window, 23, 24
determinants, 308
determining truth, 50–52
diary command, 77–78
diary off command, 78
diary on command, 78
diff() function, 312, 367
differential calculus, 312–313
differential equations, solving
numerical approach, 316–317
symbolic approach, 317–318
digital data, plotting using stairs()
function, 335–336
dimensional 3D plot, bar3() function
for, 140–142
dir command, 67
discrete math functions, 370
disease control, 363
disk
saving figures to, 252–253
saving workspaces to, 33
disp command, 68
disp() function, 159, 169, 172, 175, 184,
186, 191, 261, 270
displaying
angle distribution using rose()
function, 342–343
data distribution using stem()
function, 336–337
velocity vectors
using compass() function, 340–342
using feather() function, 340
using quiver() function, 340
divide() function, 45
dividing
matrices
effecting, 94–95
scalar, 90
two, 94–95
by vectors, 94
vectors
complex numbers, 97–99
exponents, 97–99
matrix, 94–95
scalar, 90
by scalars, 94
two, 93
working element-by-element, 97390 MATLAB For Dummies
doc() function, 175, 177, 183
docking windows, 35–36
documentation, 56
dollar sign (\$), 244, 246
dot() function, 372
dot (.) operator, 97
double, 42
double() function, 98, 293
double single quote (’’), 161
dragging, 72
drawing images using fill() function,
337–339
dsolve() function, 317–318
Dummies (website), 4, 31
• E •
e, for scientific notation, 47
E, for scientific notation, 47
EdgeColor property, 147
eig() function, 372
eigenvalues, 310–311, 372
eigs() function, 372
elementary polygon functions, 375
elements, replacing in matrices, 103–105
else clause, 196–197
empty matrix ([]), 106
endless loop, 207
enhancing plots
axes handles, 143
employing annotations, 148–150
modifying axes labels, 144–145
printing plots, 150
rotating label text, 147–148
entering data, 83–88
eps constant, 40
eps() function, 371
@eq function, 96
equal (==) operator, 51
equal sign (=), 52
equations, solving
comparing numeric and symbolic
algebra, 291–293
cubic and nonlinear equations, 294–295
interpolation, 295–296
statistics
creating pseudo-random numbers, 301
descriptive, 297–300
least squares fit, 302–306
robust, 302
Symbolic Math Toolbox
getting, 280–282
GUI, 286–290
installing, 282–286
typing commands in Command window,
290–291
equipment, designing, 365
erf() function, 371
erfc() function, 371
erfcinv() function, 371
erfcx() function, 371
erfinv() function, 371
error checking feature, 39–40
error() function, 262–264
error messages
analyzing scripts for, 169–170
creating
custom, 268–272
useful, 272–273
creating error/warning messages, 262–264
defined, 258
MException class, 260–261
responding to, 258–260
setting warning message modes, 264–265
errorbar() function, 334, 380
error-handling code, creating, 170
evalCode, 250
examples, working through, 56
exception code, creating, 268–270
exist command, 67
exp() function, 52, 99, 369
expm() function, 99, 373
expml() function, 369
exponents
functions for, 369–370
working with, 47, 99Index 391
exporting
functions, 228–229
images, 229–231
MATLAB files, 75
performing basics, 225–228
scripts, 228–229
eye() function, 111
ezcontour() function, 381
ezcontourf() function, 381
ezmesh() function, 381
ezmeshc() function, 381
ezplot() function, 377
ezplot3() function, 381
ezpolar() function, 133, 379
ezsurf() function, 381
ezsurfc() function, 381
• F •
f (form feed), 162
factor() function, 311–312, 370
factorial() function, 370
Factorial() function, 202–203
factorials, calculating, 202
factorization, 311–312
family planning, 365
feather() function, 340, 383
.fig file extension, 60
figure() function, 127, 144
figureSnapMethod, 250
file formats, supported, 252
fileattrib command, 67
filenames, 32
files
accessing, 72–73
exporting, 75
importing, 73–75
opening, 72–73
saving
commands using commands, 77–78
commands with GUI, 77
variables using commands, 77
variables with GUI, 76–77
structure of
command method, 65–69
file types, 60–61
GUI method, 61–65
working with, 69–72
FileType property, 228
FileType value, 221
fill() function, 337–339, 379
fill3() function, 382
find() function, 375
finding
data deviations using errorbar()
function, 334
dimensions of matrices with Size
column, 85–86
roots. See roots, finding
sparcity patterns using spy()
function, 344
fix() function, 46, 368
fix modifier, 46
flat 3D plots, bar() function for, 136–140
floating point values, 42
floor() function, 46, 368
floor modifier, 46
fminbnd() function, 374
fminsearch() function, 374
folders
changing current, 28–30
changing default, 30
creating, 30–31
exploring with commands, 65–69
exploring with GUI, 61–65
font
available, 235
formatting, 234–241
modifying
bold, 235–237
italic, 239–240
monospace, 237–238
underline, 240–241
FontName property, 147
FontSize property, 147
fopen() function, 259
for loop, 210
for statement, 205–206
form feed (f), 162
format, 250
format commands, 43–44392 MATLAB For Dummies
format compact command, 42–43, 84
Format value, 222
formatting
changing in Command window, 42–44
text with commands
font, 234–241
special characters, 241–243
formulas
copying and pasting, 41
entering, 40
saving as scripts, 31–33
FORTRAN, 61
Forward button (Current Folder toolbar),
27, 62
fourth-generation language, 12–13
fplot() function, 377
fprint() function, 204, 270
function browser, accessing, 52–54
function call, 39
1-D interpolation, 374
anonymous, 191–192
arithmetic, 367–368
built-in
sending data in/getting data out,
177–178
Cartesian, 371
comparing scripts with, 179
for complex numbers, 370
for constants, 371–372
creating
comparing built-in functions and custom
functions, 179–180
comparing scripts and functions, 179
global variables, 187–188
nesting functions, 190
optional arguments, 186
passing data in, 184–185
passing data out, 185–187
subfunctions, 188–189
using new functions, 182–183
discrete math, 370
eigenvalue, 372
elementary polygon, 375
exponentials, 369–370
exporting, 228–229
gridded data interpolation, 374
in-line, 191
linear equation, 372
logarithms, 369–370
matrix, 373
matrix analysis, 373
matrix operation, 372
optimization, 374
ordinary differential equation, 375
polar, 371
polynomial, 371
powers, 369–370
random number generator, 374
roots, 369–370
scattered data interpolation, 374
searching for, 54
sparse matrix manipulation, 375
special, 371
spherical, 371
statistical, 373
for text matrices, 371–372
trigonometric, 368–369
fzero() function, 374
• G •
gallery() function, 112, 310–311, 372
gca() function, 143, 322
gcd() function, 370
gcf() function, 127, 144, 230
get() function, 138, 144, 145, 147
getframe() function, 346
GetGreeting() subfunction, 189, 190
getReport() function, 260, 261
getting
current axis using gca() function, 322
Symbolic Math Toolbox, 280–282
global variables, 187–188Index 393
good coding practices, 273–275
Graphical User Interface. See GUI
(Graphical User Interface)
greater than (>) operator, 51
greater than or equal to (>=) operator, 51
Greek letters, 241–242
green technology, 362
grid commands, 125
grid() function, 321
griddata() function, 374
gridded data interpolation functions, 374
griddedInterpolant() function, 374
GUI (Graphical User Interface)
exploring folders with, 61–65
saving commands with, 77
saving figures to disk with, 252
saving variables with, 76–77
Symbolic Math Toolbox and, 286–290
• H •
handle, 91, 126
hangs, 55
help
contacting the authors, 58
documentation, 56
examples, 56
MathWorks support, 58
peer support, 57
training, 57–58
help command, 172
help() function, 172–173, 175, 177, 181
hex command, 43
hist() function, 133, 142, 380
histc() function, 143, 380
histcounts() function, 380
hold command, 120
hold off command, 126
Home tab, 22, 23
horizontal tab (t), 162
hypot() function, 369
• I •
i, used in complex numbers, 98
i constant, 40
i() function, 370
icons
explained, 3
removing from QAT, 23
identifier property, 260
idivide() function, 46, 54–55, 368
if statement, 194–198, 201
if .elseif statement, 199
image() function, 232, 370
image processing, 358
imageFormat, 251
images
drawing using fill() function,
337–339
exporting, 229–231
importing, 231–232
importing
defining delimiter types, 223–224
images, 231–232
MATLAB files, 73–75
mixed strings/numbers, 221–223
performing basics, 216–220
selected rows/columns, 224–225
improving script performance, 168
imwrite() function, 231
Inf constant, 40
Inf() function, 371
information, publishing, 165–166
in-line functions, 191
inner product, 91
inpolygon() function, 375
input() function, 158, 166, 172, 173, 174,
175, 180
installing
MATLAB, 19–22
Symbolic Math Toolbox and, 282–286
int() function, 246, 313–314
int8, 42394 MATLAB For Dummies
int8() function, 98, 293
int16, 42
int16() function, 99, 293
int32, 42
int32() function, 98, 99, 293
int64, 42
int64() function, 99, 293
integer values, 42
integral calculus, 313–314
interacting
with daspect() function, 329–331
with pbaspect() function, 332–333
interactions
determining truth, 50–52
error messages, 54–55
help
contacting the authors, 58
documentation, 56
examples, 56
MathWorks support, 58
peer support, 57
training, 57–58
math syntax
dividing, 45–46
exponents, 47
multiplying, 45–46
subtracting, 45–46
storage locker, 48–50
using as a calculator
changing Command window formatting,
42–44
copying and pasting formulas, 41
entering formulas, 40
entering information at the prompt,
38–40
suppressing Command window
output, 44
interface
starting for first time, 22–24
interp2() function, 374
interp3() function, 374
interpl() function, 374
interpn() function, 374
interpolation, 295–296
inv() function, 95, 96, 372
isdir command, 67
isfinite() function, 372
isinf() function, 372
isnan() function, 372
isprime() function, 370
isreal() function, 370
italic
using, 239–240
• J •
j() function, 370
Java, 13, 16
Joint Photographic Experts Group (.jpeg)
files, 230
• K •
kron() function, 372
• L •
label text, rotating, 147–148
last() function, 260
LaTeX (website), 240
layouts
changing, 33–36
choosing, 36
saving, 36
lcm() function, 370
ldivide() function, 367
learning curve, 17
least squares fit, 302–306
left division, 90
legend() function, 126
length() function, 113
less than (<) operator, 51
less than or equal to (<=) operator, 51Index 395
line color/markers/style, 122–123
linear algebra
determinants, 308
eigenvalues, 310–311
factorization, 311–312
reduction, 308–310
linear equation functions, 372
lines, starting with semicolon, 84–85
LineWidth property, 147
linsolve() function, 372
linspace() function, creating ranges of
values using, 86–87
Linux, platforms supported by
MATLAB, 20
listfonts() function, 235
local variables, 187
log() function, 52, 369
log1p() function, 369
log2() function, 369
log10() function, 369
logarithms, functions for, 369–370
loglog() function, 132, 378
logm() function, 373
long command, 43
longe command, 43
longeng command, 43
lookfor() function, 174
loose command, 44
ls command, 67
• M •
.m file extension, 60–61
Mac OS X, platforms supported by
MATLAB, 20
Macro Assembler, 13
magic() function, 112, 309, 372
Margin property, 147
.mat file extension, 60, 61
math
requirements for MATLAB, 15
math syntax
dividing, 45–46
exponents, 47
multiplying, 45–46
subtracting, 45–46
MathWorks, 21, 58
activating, 21–22
functions
how to use, 14–16
installing, 19–22
interacting with. See interactions
interface, 22–36
minimum requirements for, 20
platforms supported by, 19–20
real-life uses for, 13–14
reasons for needing, 11–13
Turing machines, 8
uses for, 8, 10–11, 353–359
using as a calculator, 38–44
website, 176
working with files in, 69–72
MATLAB Central, 57
MATLAB Programming/Error Messages
(website), 267
MATLAB Tips (website), 268
matrices
accessing multidimensional, 102–103
cell arrays/structures, 107–110
checking relations, 96
complex numbers, 97–99
creating multidimensional, 100–102
creating powers of, 95–97
dividing
effecting, 94–95
scalar, 90
two, 94–95
by vectors, 94396 MATLAB For Dummies
entering data, 83–88
exponents, 99
functions, 111–113
help, 110
linear algebra, 82–83
modifying size, 105–106
multiplying
effecting, 90–93
scalar, 90
two, 93
multiplying by vectors, 92
operation functions, 372
replacing individual elements, 103–104
replacing range of elements, 104–105
subtracting, 88–89
testing, 110–113
transposing with apostrophes, 87–88
working element-by-element, 97
working with, 226
matrix analysis functions, 373
matrix functions, 373
max() function, 300, 373
maxHeight, 251
maximizing windows, 34
maxOutputLines, 251
maxWidth, 251
.mdl file extension, 61
mean() function, 300, 373
median() function, 300, 373
Mersenne Twister, 301
mesh() function, 382
meshc() function, 382
meshgrid() function, 374
meshz() function, 382
message property, 260
.mex* file extension, 61
MException class, 260–261
military equipment, 365
min() function, 300, 302, 373
minimizing
Toolstrip, 23
windows, 34
minus() function, 45, 367
mistakes, recovering from
common fixes for error messages,
267–268
creating error messages
custom, 268–272
useful, 272–273
error messages
creating error/warning messages,
262–264
MException class, 260–261
responding to, 258–260
setting warning message modes,
264–265
good coding practices, 273–275
mixed data, working with, 226–228
mixed strings/numbers, importing,
221–223
mkdir command, 67
mldivide() function, 367
MLFG (Multiplicative Lagged Fibonacci
Generator), 301
mod() function, 46, 368
mode() function, 300, 373
modifying
axes labels, 144–145
Command window formatting, 42–44
current folder, 28–30
default folder, 30
font
bold, 235–237
italic, 239–240
monospace, 237–238
underline, 240–241
layout, 33–36
matrix size, 105–106
plots
deleting plots, 128
figure() function, 127
simple changes, 125
working with subplots, 128–132
matrices (continued)Index 397
monospace
using, 237–238
Monster.com (website), 361
movefile command, 67
movie() function, 346–347
movies, 346–347
mpower() function, 96, 367
mrdivide() function, 367
MRG (Multiple Recursive Generator), 301
mtimes() function, 367
Mueller, John Paul (author)
blog, 115, 257
contacting, 58
multidimensional matrices
accessing, 102–103
creating, 99–102
Multiple Recursive Generator (MRG), 301
Multiplicative Lagged Fibonacci Generator
(MLFG), 301
multiplying
matrices
effecting, 90–93
scalar, 90
two, 93
matrices by vectors, 92
vectors
complex numbers, 97–99
exponents, 99
matrix, 90–93
scalar, 90
two, 91
working element-by-element, 97
multivariate calculus, 314–315
myVariable variable, 49
• N •
\n (new line), 162
\N (octal number), 162
\n character, 161
NaN constant, 40
NaN() function, 372
NASA (National Aeronautic and Space
nchoosek() function, 370
ndgrid() function, 374
nesting functions, 190
New File option, 64
New Folder option, 64
new line (n), 162
nonlinear equations, 294–295
norm() function, 373
not equal (~=) operator, 51
nthroot() function, 369
numeric data, working with, 226
numerical analysis, performing, 355
• O •
Object-Oriented Programming (OOP), 12
objects, 347–348
oblique italic, 239–240
obtaining
current axis using gca() function, 322
Symbolic Math Toolbox, 280–282
octal number (N), 162
ode23() function, 375
off, 264
on, 264
ones() function, 111
OOP (Object-Oriented Programming), 12
open command, 73
open command, 67
Open option, 63
opening
MATLAB files, 72–73
windows, 34–35
optimization functions, 374
optional arguments, 186
ordinary differential equation functions, 375
organizing
with MATLAB, 11
storage locker, 48–50
otherwise clause, 200
outer product, 91
output formats, supported, 248
output page, configuring, 253–255
outputDir, 251398 MATLAB For Dummies
• P •
.p file extension, 61
pareto() function
procedures for, 143
ranking related measures using, 334–335
passing
data in, 184–185
data out, 185–187
Paste option, 64
pasting
copying and, 70–71
copying and, into scripts, 159–160
cutting and, 71–72
formulas, 41
pause() function, 211, 347
pbaspect() function, interacting with,
332–333
pcolor() function, 382
peer support, 57
percent (%) character, 161, 162–163,
180, 204
performance, improving for scripts, 168
performing
exporting basics, 225–228
family planning, 365
importing basics, 216–220
numerical analysis, 355
perms() function, 370
pi constant, 40
pi() function, 372
pie() function, 132–133, 378
pie3() function, 378
platforms supported by MATLAB, 19–20
plot() function
creating multiple plots in single
commands, 124
line color/markers/style, 122–123
plot routines
displaying
angle distribution using rose()
function, 342–343
velocity vectors using compass()
function, 340–342
velocity vectors using feather()
function, 340
velocity vectors using quiver()
function, 340
drawing images using fill() function,
337–339
finding
data deviations using errorbar()
function, 334
sparcity patterns using spy()
function, 344
plotting digital data using stairs()
function, 335–336
polar() function, 342
ranking related measures using
pareto() function, 334–335
showing data distribution using stem()
function, 336–337
plot3() function, 381
plotmatrix() function, 381
Plots tab options, creating plots using,
120–122
plotting
with 2D information, 132–133
with 3D information
bar() function, 136–140
bar3() function, 140–142
barh() function, 142–143
116–117
creating plots using commands, 117–119
creating plots using Plots tab options,
120–122
creating plots using Workspace window,
119–120
creating plots with colorbar() function,
326–329
digital data using stairs() function,
335–336
enhancing plots
axes handles, 143
employing annotations, 148–150
modifying axes labels, 144–145Index 399
printing plots, 150
rotating label text, 147–148
modifying plots
deleting plots, 128
figure() function, 127
simple changes, 125
working with subplots, 128–132
plot() function
creating multiple plots in single
commands, 124
line color/markers/style, 122–123
routines for, 377–383
saving plots as scripts, 249
uses for, 116
plotyy() function, 132, 377
plus() function, 45, 367
pol2cart() function, 371
polar coordinates, 342
polar() function, 143, 342, 379
polar functions, 371
poly() function, 371
poly2sym() function, 293
polyarea() function, 375
polyder() function, 371
polyeig() function, 371
polyfit() function, 371
polyint() function, 371
polynomial functions, 371
polyval() function, 371
Position property, 148
pow2() function, 369
power() function, 367
powers, functions for, 369–370
primary function, 188
primes() function, 370
print() function, 150, 253
printing
configuring output page, 253–255
data, 255
formatting text with commands
font, 234–241
special characters, 241–243
plots, 150
printopt() function, 253
procedural languages, 16
procedure, 153
prod() function, 367
professional uses, 361–366
program/programming, 9–10, 358–359
prompt, entering information at the,
38–40
Prompt variable, 161
pseudo-random numbers, creating, 301
publish() function, 228–229, 248,
250–251
publishing
formatting text with commands
font, 234–241
special characters, 241–243
information, 165–166
saving figures to disk, 252–253
pwd command, 68
Python, 16
• Q •
query, 264
quiver() function, 340, 383
quiver3() function, 383
• R •
\r (carriage return), 162
rand() function, 101, 111, 301, 374
randi() function, 301, 374
randn() function, 101, 111, 301, 374
random number generator functions, 374
randperm() function, 301
Range property, 228
Range value, 222
rank() function, 373400 MATLAB For Dummies
ranking related measures using pareto()
function, 334–335
rat command, 44
rat() function, 370
rdivide() function, 367
window), 27
225, 228
real() function, 370
reallog() function, 370
realpow() function, 370
realsqrt() function, 370
Recognized Data Files drop-down list,
73–74
rectint() function, 375
recursive functions, creating, 201–205
recycle command, 68
red lines, 40
Reduced Row Echelon Form (RREF),
308–310
reduction, 308–310
Refresh option, 65
related measures, ranking using pareto()
function, 334–335
rem() function, 46, 368
Remember icon, 3
removing
icons from QAT, 23
plots, 128
Rename option, 63
break clause, 207–208, 209
for loop, 210
return clause, 208–209
for statement, 205–206
while loop, 210
while statement, 206–207
replacing elements in matrices, 103–105
requesting support from MathWorks, 58
research, 356–357
Research and Development (R&D), 364–365
reset() function, 144
resizing matrices, 105–106
responding to error messages,
258–260
rethrow() function, 260
return clause, 208–209
revising scripts, 167
ribbon() function, 377
Ribbon interface, 22
right division, 90
right-clicking, 70
rmdir command, 68
rng() function, 113, 297, 374
robust statistics, 302
roots, finding
comparing numeric and symbolic
algebra, 291–293
cubic and nonlinear equations,
294–295
interpolation, 295–296
functions for, 369–370
statistics
creating pseudo-random numbers, 301
descriptive, 297–300
least squares fit, 302–306
robust, 302
Symbolic Math Toolbox
getting, 280–282
GUI, 286–290
installing, 282–286
typing commands in Command
window, 290–291
roots() function, 293–294, 371
rose() function, 143, 380
rotate3d() function, 346–347
rotating label text, 147–148
rotation, 320
Rotation property, 147
round() function, 46, 368
round modifier, 46Index 401
rows
importing, 224–225
starting with semicolon, 84–85
rref() function, 308–310, 373
running scripts, 33
• S •
save command, 77
saveas() function, 231, 249
saving
commands as scripts, 31–33
figures to disk, 252–253
files
commands using commands, 77–78
commands with GUI, 77
variables using commands, 77
variables with GUI, 76–77
formulas as scripts, 31–33
layouts, 36
plots as scripts, 249
workspaces to disk, 33
SayHello() function, 184
SayHello2() function, 185, 186
scalar multiplication/division, of vectors/
matrices, 90
scalars, dividing vectors by, 94
scatter() function, 133, 380
scatter3() function, 381
scattered data interpolation functions, 374
science, 356
Science, Technology, Engineering and
Mathematics (STEM), 10, 13–14
scientific notation, 47
Script option (Command window), 26
scripting
analyzing scripts for errors, 169–170
benefits of, 154
calling scripts, 167–168
creating scripts
continuing long strings, 160–162
converting Command History into
scripts, 160
copying and pasting into scripts,
159–160
using commands for user input, 158–159
improving script performance, 168
revising scripts, 167
when to use, 155
scripts
comparing with functions, 179
creating recursive functions, 201–205
decision-making
if statement, 194–198, 201
switch statement, 199–201
exporting, 228–229
fprint() function, 204
break clause, 207–208, 209
for loop, 210
return clause, 208–209
for statement, 205–206
while loop, 210
while statement, 206–207
running, 33
saving formulas/commands as, 31–33
saving plots as, 249
Search option (Current Folder toolbar), 28
searching, for functions, 54
sec() function, 369
secd() function, 369
sech() function, 369
second-generation language, 13
See Examples option (Command
window), 26
seed value, 297
selecting layouts, 36
semicolon (;)
separating values with, 85
starting new lines/rows with, 84–85
semilogx() function, 133, 378
semilogy() function, 133, 378402 MATLAB For Dummies
sending data in/getting data out, 177–178
sendmail() function, 265, 266
separating values with commas/
semicolons, 85
set() function, 130–131, 139, 145
setpref() function, 265
setting
breakpoints, 169
warning message modes, 264–265
sharing MATLAB files, 72–75
Sheet property, 228
Sheet value, 222
short command, 43
shorte command, 43
shorteng command, 43
shortg command, 43
Show in Explorer option, 63
showCode, 251
showing
angle distribution using rose() function,
342–343
data distribution using stem() function,
336–337
velocity vectors
using compass() function, 340–342
using feather() function, 340
using quiver() function, 340
sign() function, 370
SimpleFor() function, 206
simulations, 357, 366
sin() function, 52, 118, 368
sind() functuion, 368
single, 42
single() function, 98, 293
single quotes (’), 49
sinh() function, 368
Size column, finding dimensions of
matrices with, 85–86
size() function, 113
Sizemore, Jim (author)
contacting, 58
.slx file extension, 61
solve() function, 288, 290, 291,
293–294
solving
differential equations
numerical approach, 316–317
symbolic approach, 317–318
solving equations. See equations, solving
sparcity patterns, finding using spy()
function, 344
sparse matrix manipulation functions, 375
special characters, 241–243
special functions, 371
speech recognition software, 363
sph2cart() function, 371
spherical functions, 371
Spline() function, 374
116–117
sprintf() function, 270
spy() function, 113, 344, 375, 381
SQL (Structured Query Language), 13
sqrt function, 244
sqrt() function, 370
sqrtm() function, 372, 373
square brackets ([]), entering values
inside, 84
stack property, 260
stairs() function, 335–336, 380
starting
MATLAB for first time, 22–24
new lines/rows with semicolon, 84–85
statistical functions, 373
statistics
creating pseudo-random numbers, 301
descriptive, 297–300
least squares fit, 302–306
robust, 302
Statistics Toolbox (website), 297
Status bar, 23, 24
std() function, 300, 302, 373
STEM (Science, Technology, Engineering
and Mathematics), 10, 13–14
stem() function, 336–337, 380
stem plot, 336
stem3() function, 382Index 403
stopping, when hanging, 55
storage locker, organizing, 48–50
streamline() function, 383
streamribbon() function, 383
streamtube() function, 383
strings, continuing long, 160–162
structure
files
command method, 65–69
file types, 60–61
GUI method, 61–65
working with, 69–72
provided by MATLAB, 11
using in matrices, 107–110
Structured Query Language (SQL), 13
student version, 21
stylesheet, 251
subfunctions, 188–189
subplot() function, 130
subplots, working with, 128–132
subscript, 242–243
subtracting
matrices, 88–89
vectors, 88–89
sum function, 245–246
sum() function, 368
super plots
animation
movies, 346–347
objects, 347–348
creating axis dates using datetick()
function, 322–326
creating plots with colorbar() function,
326–329
grid() function, 321
interacting with daspect() function,
329–331
interacting with pbaspect() function,
332–333
obtaining current axis using gca()
function, 322
plot routines
displaying angle distribution using
rose() function, 342–343
displaying velocity vectors using
compass() function, 340–342
displaying velocity vectors using
feather() function, 340
displaying velocity vectors using
quiver() function, 340
drawing images using fill() function,
337–339
finding data deviations using
errorbar() function, 334
finding sparcity patterns using spy()
function, 344
plotting digital data using stairs()
function, 335–336
polar() function, 342
ranking related measures using
pareto() function, 334–335
showing data distribution using stem()
function, 336–337
superscript, 242–243
support, requesting from
MathWorks, 58
suppressing Command window output, 44
surf() function, 382
surf1() function, 382
surfc() function, 382
surfnorm() function, 382
switch statement, 199–201
sym() function, 293
sym2poly() function, 293
Symbolic Math Toolbox
getting, 280–282
GUI, 286–290
installing, 282–286
typing commands in Command window,
290–291
symfun() function, 293404 MATLAB For Dummies
• T •
\t (horizontal tab), 162
table2cell() function, 226–228
tan() function, 52, 368
tand() function, 368
tanh() function, 368
Technical Stuff icon, 3
Teknomo, Kardi (programmer), 83
TestCustomException() function, 272
testing harness, 268
testing matrices, 110–113
text, formatting with commands
font, 234–241
special characters, 241–243
text matrix functions, 371–372
textscan() function, 216, 218–220,
221, 225
third-generation language, 13
throw() function, 260, 270
throwAsCaller() function, 261
times() function, 45, 367
@times function, 91
Tip icon, 3
title() function, 145–147
toolbox, MATLAB, 12
Toolstrip, 22, 23
trace() function, 373
training, 57–58
transpose() function, 372
transposing matrices with apostrophes,
87–88
TreatAsEmpty value, 221
tree structure, 77
trial version, 21
trigonometric functions, 368–369
trucks, 364
truth, determining, 50–52
try .catch structure, 259
Turing machines, 8
.txt file extension, 60
type command, 68
typing commands, 24–25, 290–291
• U •
uint8, 42
uint8() function, 99, 293
uint16, 42
uint16() function, 99, 293
uint32, 42
uint32() function, 99, 293
uint64, 42
uint64() function, 99, 293
uminus() function, 45, 367
underline
using, 240–241
underscore (_), 242
undocking windows, 35–36
unexploded ordinance, 362
unimodular matrix, 308
Up One Level button (Current Folder
toolbar), 27, 63
uplus() function, 45, 367
useful error messages, 272–273
useNewFigure, 251
user input, using commands for, 158–159
userpath command, 30
userpath() function, 38–39
UseTextscan() function, 228–229
• V •
\v (vertical tab), 162
values
creating
ranges of using colons, 86
ranges of using linspace() function,
86–87
entering inside square brackets, 84
separating with commas/semicolons, 85
var() function, 300, 373
variables
avoiding existing names, 50
case sensitivity of, 49
creating, 49
defined, 37
defining names for, 48–49
global, 187–188Index 405
local, 187
saving using commands, 77
saving with GUI, 76–77
vectors
dividing
complex numbers, 97–99
exponents, 97–99
matrices by, 94
matrix, 94–95
scalar, 90
two, 93
working element-by-element, 97
dividing by scalars, 94
entering data, 83–88
linear algebra, 82–83
multiplying
complex numbers, 97–99
exponents, 99
matrix, 90–93
scalar, 90
two, 91
working element-by-element, 97
multiplying matrices by, 92
subtracting, 88–89
velocity vectors
displaying using compass()
function, 340–342
displaying using feather()
function, 340
displaying using quiver() function, 340
verbose, 264
vertical tab (v), 162
Video option (Command window), 26
view() function, 140–142
viewing Current Folder window, 28–33
visdiff command, 68
vpa() function, 293
vpasolve() function, 291–292
• W •
warning() function, 262–264
Warning! icon, 3
warning messages
creating, 262–264
defined, 258
setting modes, 264–265
Watch This Video tutorial, 26
waterfall() function, 382
web() function, 248
websites
accessing .fig files, 60
activation help, 21–22
blog, for this book, 16
bucky() function, 344
Cartesian coordinates, 340–341
cheat sheet, 3
color presentation, 255
colormap() function
documentation, 329
companies using MATLAB, 14
for companion files, 4
complex numbers, 97
composition of velocity vectors, 340
Cubic Equation Calculator, 295
Curve Fitting Toolbox, 297
data formats for importing, 75
dividing two vectors, 93
Dummies, 4, 31
Earth statistics, 40
education-related materials, 354
exponents, 99
file formats, 230
formats, 77
functions, 176
interpolation, 295
LaTeX, 240
least fit squares, 302
linear algebra resources, 83
math tutorials, 15
MATLAB, 176
MATLAB installation help, 21
MATLAB Programming/Error
Messages, 267
MATLAB Tips, 268406 MATLAB For Dummies
Mersenne Twister, 301
minimum requirements for MATLAB, 20
MLFG (Multiplicative Lagged Fibonacci
Generator), 301
monospaces fonts, 238
Monster.com, 361
MRG (Multiple Recursive Generator), 301
polar coordinates, 342
prime factorization, 311
Reduced Row Echelon Form (RREF),
308–309
standard statistical functions, 300
Statistics Toolbox (website), 297
stem plot, 336
student version, 21
Teknomo, Kardi, 83
text properties, 242
trial version, 21
updating files to .slx file format, 61
well-conditioned matrix, 308
what command, 69
what() function, 175
which command, 69
which() function, 174
while loop, 210
while statement, 206–207
windows
closing, 34–35
docking, 35–36
maximizing, 34
minimizing, 34
opening, 34–35
undocking, 35–36
Windows, platforms supported by
MATLAB, 20
winopen command, 69
Workspace window
creating plots using, 119–120
workspaces, saving to disk, 33
WriteRowNames property, 228
writetable() function, 225, 228
WriteVariableNames property, 228
writing
• X •
xlabel() function, 125
• Y •
ylabel() function, 125
• Z •
zeros() function, 100, 101, 111
zlabel() function, 144
zlim() function, 145
ZTickLabel property, 144
كلمة سر فك الضغط : books-world.net