Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Index

%, 32 argument
%e format specifier, 64 input, 208
%f format specifier, 64 input, pass by reference, 214
%g format specifier, 64 input, pass by value, 214
&, 113 arithmetic operator, 34
’, 115, 128 array, 9, 24
.’, 115 2-D, 125
.*, 36 cell, 240
./, 36 multi-dimensional, 140
.ˆ, 36 string, 144
:, 9, 129 Array Editor, 25
;, 8, 38 array operation, 36, 136
˜, 113 ASCII code, 144
π, 8 asin, 92
estimation of, 306 asinh, 92
0-1 vector, 306 aspect ratio, 62
3-D plot, 162 assignment statement, 38, 66, 241
atan, 92
A atan2, 62, 92
abs, 62, 92 atanh, 92
acos, 92 axis, 156
acosh, 92 equal, 62
algorithm, 78 normal, 62
all, 118, 135 axis limits, 156
example, 118 azimuth, 170
AND, 113
angle, 62 B
animation, 253 bacteria division, 300
comet3, 163 bacteria growth, 306, 335
ans, 25, 38 balance delimiters, 41
any, 118 bar, 171
example, 118 bar graph, 235
apostrophe, 128 base workspace, 212
included in string, best fit, 318
143 binary to decimal conversion, 151
area, 171 binomial coefficient, 185 383
384 Index

Bisection method, 328 complex conjugate transpose, 62


bit, 25 complex numbers, 61
bitwise logical operations, 113 concatenation of strings, 144
blanks, 146 condition estimator, 319
break, 188, 194 conj, 62
breakpoint, 219 Contents.m, 212
Bubble Sort, 236 context menu, 19
bug, 201 continuation of statement, 32, 38
byte, 25 continue, 149, 195
contour, 165
C contour plot, 13
calendar, 9 contour3, 166
camel caps, 24 conversion, binary to decimal, 151
cartesian co-ordinates, 160 cos, 93
case, 61 cosh, 93
case sensitivity, 24 cot, 93
catch, 149 Crank-Nicolson method, 345
ceil, 92 csc, 93
cell, 240, 241 cumsum, 93
cell array, 240 current directory, 15, 19
celldisp, 243 Current Directory browser, 19
cellplot, 243 curve fitting, 348
Cervantes, 151 cut and paste, 17
chaos, 182, 255, 340
butterfly, 343 D
trajectory, 343 data types, 34
char, 145 date, 9, 93
cla, 159 deal, 240
clc, 9 deblank, 146
clear, 25 Debugger, 219
clear M-file, 213 debugging, 201
clf, 159 degrees to radians, 8
clipboard, 17 del2, 259
clock, 51, 92, 267 delimiter highlighting, 41
colon operator, 9, 27, 128 demo, 12
initialization, 27 desktop, 15
precedence, 35 default, 15
color, 156 det, 143
colorbar, 258 determinate repetition, 185
colormap, 256 diag, 136
comet3, 163 diary, 30, 103
command, 39 dice, 112
command line, 7 diff, 333
command line editing, 7 differential equation, 334
Command Window, 5 disp, 42
command/function duality, 217 scale factor, 45
comment, 32 division, matrix, 319
compass, 172 docking, 15
compiler, 20 dot product, 37
Index 385

dot-transpose operator, 115 eye, 134


double, 34 ezcontourf, 173
double-precision, 34
doubling time of an investment, 190 F
drawnow, 255 factorial, 47
false, 107
E feather, 173
editing a plot, 251 feof, 101
eig, 143 feval, 216
eigenvalue, 311 Fibonacci numbers, 225
eigenvector, 312 field, 238
element-by-element operation, 36 fieldnames, 239
ellipse, equation of, 181 figure, 10, 159
ellipsis, 32, 38 figure window, 10, 157
elseif, 57 file I/O functions, 65
empty, 27 file identifier, 100
array, 118 fill, 174
end, 130 find, 118
end of file, 101 findobj, 249
eps, 109 finite difference scheme, 336, 345
error fix, 93
fatal, 201 fixed point, 33, 44
logical, 202 fliplr, 136
rounding, 203 flipud, 136
run-time, 219 floating point, 33, 44
syntax, 201 floor, 49, 93
trapping, 148 fopen, 100
errorbar, 172 for, 48
escape code, 64 command line version, 50
etime, 51 common error, 50
Euler’s method, 334 index, 48
eval, error trapping, 148 iteration count, 49
exclusive OR, 113 more general, 50
exist, 118 most general form, 137
exp, 93 nested, 138, 188
explicit list, initializing vectors, 26 replaced by vectorization, 50
expm, 143, 339 used for determinate loop, 196
exponent, 33 format, 43, 44
exponential fit, 318 format specifiers, 64
exponential growth, 335 formula, vectorization, 40
exponential matrix, 339 Fourier series, 198
exporting ASCII data, save, 97 fplot, 161
exporting binary data, save, 97 fprintf, 63
expression, 32–34, 37 escape code, 64
ans, 38 string, 146
display suppressed, 38 fractal, 182
evaluation, 148 fread, 101
logical, 53, 113 frequency distribution, 235
response to input, 66 fseek, 102
386 Index

ftell, 103 grid, on graph 155


full, 322 gtext, 155
full matrix, 320 guessing game, 188
function, 39, 211 GUI, 263
handle for passing as argument, 216 handles structure, 270
help, 212 plotting graph on, 271
MATLAB Function Reference, 92 guide, 263
name resolution, 218
P-code file, 215 H
private, 215 H1 line, 212
subfunction, 215 Halley’s comet, 181
function functions, 217 Handle Graphics objects, 245
function M-file, 207 handle
function/command duality, 217
function, 216
fzero, 329
graphics object, 245
handles structure in a GUI, 270
G Help, 15
Gauss reduction, 130 (324 E) help, 12
Gaussian random number, 305 Help browser, 15
gca, 247 Help Navigator, 92
gcbo, 267 help for a function, 212
gcf, 246 helpwin, 91
gco, 247 hexadecimal, 44
get, 247
hidden name, 65, 202, 218
Gibbs phenomenon, 198
hist, 175
ginput, 159
histogram, 235
global, 212
hold, 155
gradient, 167, 168
graph, 10
graphical user interface, 263
I
graphics i, 61
2-D, 153 I/O functions, 65
3-D, 162 identity matrix, 134
3-D rotation, 169 if, 53
axis limits, 156 command line version, 53
contour plot, 165 elseif, 57
cropping a surface, 167 nested, 59
easy-to-use commands, 154 vectorized with logical vector,
editing a plot, 251 119
line type, 156 if-else, 55
logarithmic plot, 159 command line, 55
mesh surface, 163 ill conditioning, 319, 323
multiple plots, 155, 157 imag, 62
on GUI, 271 Import Wizard, 98
plotting symbol, 156 importing ASCII data, load, 97
polar co-ordinates, 160 importing binary data, load, 98
rapidly changing functions, 161 importing data, Import
saving, 260 Wizard, 98
vector field, 167 inclusive OR, 113
Index 387

indeterminate repetition, 185, 188 LODE, 339


index of for, 48 log, 94
Inf, 7 log10, 94
infinity, 7 logarithmic plot, 159
initialization, colon operator, 27 logarithmic spiral, 180
explicit list, 26 logical error, 202
inline object, 208 logical expression, 53, 107, 113
input, 66 vector, 108
argument, 208 logical function, 117
string, 143 logical operator, 57, 113
vector, 66 precedence, 114
input argument, 208 logical vector, 108
int2str, 146 subscripting with, 116
interpolation, 331 loglog, 159
interpreter, 20 lookfor, 12, 212
inv, 143 loop
ischar, 147 determinate, 185
isempty, 118 indeterminate, 188
isglobal, 212 Lorenz, 340
isinf, 118 Lotka-Volterra model, 343
isnan, 118 lower, 147
isothermal, 165 lu, 143
iteration count, 49
M
J M-file, 18
function, 207
j, 61
function passed as argument,
216
L macro, 148
lasterr magic square, 13, 135
error trapping, 148 mantissa, 33, 44
Launch Pad, 12 marker, 156
least squares, 318 Markov chain, 313
left division, 34, 316, 319 matrix, 26, 29, 125
Legendre polynomial, 225 array operation, 136
length, 94 creating, 127
Leslie matrix, 310 deleting rows and columns, 132
lighting, 259 division, 319
limit of sequence, 47 duplicating rows and columns, 132
line numbers, 219 enlarging, 128
line style, 156 exponential, 339
linear equations exponentiation, 142
over-determined, 317 full, 320
residual, 317 Leslie, 310
solution, 315 multiplication, 140
under-determined, 318 operation, 37, 140
linspace, 28 plot, 153
list, sorting, 236 sparse, 320
load, 97 subscript, 127
388 Index

matrix (continued) partial differential equation,


transpose, 29, 128 344
visualization, 168 predictor-corrector, 338
max, 94, 238 Runge-Kutta method, 339
mean, 94 Simpson’s rule, 331
menu, 195 solution of equations, 325
mesh, 164 Trapezoidal rule, 330
mesh surface, 163 numerical solution
meshc, 166 differential equations, 334
meshgrid, 163 equations, 325
meshz, 175
Mexican hat, 13 O
min, 94, 238 object, 244
mlock, 213 Handle Graphics, 245
Monte Carlo estimation of π, 306
object-oriented programming,
more, 43, 193
244
multi-dimensional array, 140
ones, 133, 145
multiple lines in Command
operand, 34
Window, 17
operating system, shelling out to,
multiple plots, 157
67
on same axes, 155
operation
munlock, 213
array, 36
element-by element, 36
N matrix, 140
name hiding, 202, 218 operator precedence, complete list,
NaN, 7 359
nargin, 214
operator 114
nargout, 214
arithmetic, 34
nested fors, 188
colon, 128
nested ifs, 59
dot-transpose, 115
Newton quotient, 204, 224, 332
left division, 316
Newton’s method, 46
logical, 57, 113
in general, 325
precedence, 34, 114
normally distributed random number,
relational, 53
305
transpose, 115
NOT, 113
not-a-number, 7 OR, 113
num2str, 43, 146 exclusive, 113
number, 33 output, 42
numerical differentiation, 332 paging, 43
numerical integration, 330 suppressed with semi-colon, 38
numerical method, 325 to a file with fprintf, 64
Bisection method, 328 output argument, 210
differential equation, 334 over-determined system, 317
differentiation, 332
Euler’s method, 334 P
integration, 330 P-code file, 215
Newton quotient, 332 paging output, 43
Newton’s method, 325 palindrome, 151
Index 389

partial differential equation, 344 quadratic equation, 86


pascal, 134 structure plan, 86
pause, 170 quadrature, 332
pcode, 215 quiver, 167
peaks, 170 quote in string, 43
persistent variable, 212
pi, 8
pie, 176 R
pitfall, 201 radio-active decay, 307
plot, 153 RAM, 19
3-D version, 162 rand, 94, 111, 133, 297
logarithmic scale, 159 seeding, 298
polar co-ordinates, 160 uniform, 297
plot edit mode, 251 randn, 305
plot3, 162 random access memory, 19
plotedit, 251 random number, 28, 111
plotyy, 155 counting, 111
Poisson process, 302 generation, 297
polar, 160 normal, 305
polar co-ordinates, 160 uniform, 297
polynomial fitting, 349
random walk, 235, 300, 313
pow2, 94
rat, 44
pre-allocation, 229
real, 62
precedence, 114
realmax, 33, 94
arithmetic operators, 34
realmin, 33, 94
colon operator, 35
recall, smart, 7
logical operator, 114
recursion, 221
of operators, complete list, 114, 359
transpose, 36 redimensioning, 230
predator-prey model, 343 reference, pass by, 214
predictor-corrector method, 338 relational operator, 53
Preferences, 44 relative accuracy, 33
prime number rem, 94
largest known, 192 removing elements of an array, 29
test, 191 repmat, 132
private function, 215 reshape, 131
prod, 94 reshaping a matrix, 131
Profiler, 215 residual, 317
program, 16 ribbon, 176
programming style, 67 right division, 319
projectile motion, 192 rmfield, 240
projectile trajectory, 192 rolling dice, 112
Property Editor, 162 root of an equation, 325
pseudo-code, 85 roots, 268
pseudo-random number, 94 rot90, 136
round, 113
Q rounding error, 203, 332
qr, 143 run-time error, 219
quad, 332 Runge-Kutta method, 339
390 Index

S spinning coins, 298


save, 97 spiral
saving a file, 18 Archimedes, 180
saving a graph, 260 logarithmic, 180
scalar, 9 sprintf, 147
expansion, 37 spy, 169, 322
product, 37 sqrt, 8
scientific notation, 33 stable age distribution, 312
display, 44 stairs, 177
scope, 212 statement, 7, 38, 39
script file, 18 assignment, 38
hidden by variable of same continuation, 38
name, 65 stem3, 178
recommended way to run, 19 strcmp, 146
search path, 65 string, 43, 125
sec, 31 array of characters, 144
seeding rand, 298 ASCII code, 145
semi-colon, 8 comparison, 146
semilogx, 159 concatenation, 144
semilogy, 159 containing quote, 43
sensitivity analysis, 323 fprintf, 146
separator, 39 including apostrophe, 143
series for π, 197 input, 143
set, 248 two-dimensional, 147
Shakespeare, 151 struct, 239
shelling out to the operating structure, 238
system, 67 structure plan, 17, 85
sign, 52 quadratic equation, 86
Simpson’s rule, 331 structured programming, 88
simulation, 113, 235 style, 67
bacteria division, 300 subfunction, 215
bacteria growth, 306 subplot, 157
game of eights, 307 subscript, 28, 127
π, estimation of, 306 logical vectors, 116
radio-active decay, 307 out of range, 128
random walk, 300 vector, 116
rolling a die, 299 subscripting with logical vectors, 116
spinning coins, 298 sum, 51, 52, 111
traffic flow, 302 sunflower head, 181
sin, 8, 39 surf, 164
single-precision, 34 surfc, 166
size, 25, 167 svd, 143
smart indenting, 49 switch, 60
smart recall, 7 syntax error, 201
sort, 235, 237 syntax highlighting, 49
sort, bubble, 236
sound, 188 T
sparse, 321, 322, 346 tab completion, 11
sparse matrix, 320, 346 tan, 11, 110, 154
Index 391

tanh, 284 vector, 9, 26


Taylor series, exponential, 224 0-1, 306
text label on graph, 155 colon operator, 27
text macro, 148 explicit list, 26
tic, 51 incompatible sizes, 202
tiling, 132 input, 66
title, 155 pre-allocation, 229
toc, 51 redimensioning, 230
top down programming, 86 removing element, 117
traffic flow, 302 scalar product, 37
transpose, 28, 29, 128 subscript, 28, 116
complex conjugate, 62 transpose, 28
precedence, 36 vectorization, 40
Trapezoidal rule, 330 instead of for, 50
tridiagonal matrix, 346 view, 169
tril, 136 visualization of matrix, 168
triu, 136
true, 107 W
truecolor, 259 waterfall, 178
truncation error, 349 while, 189
try/catch, 149 command line form, 190
type, 19 used for indeterminate loop,
196
U vector condition, 190
uicontrols, 264 who, 25
under-determined system, 318 whos, 25
undocking, 15 why, 14
unhiding a name, 65 workspace, 24
uniformly distributed random base, 212, 214
number, 297 function, 25
update process, 227 Workspace Browser, 25
upper, 147
X
V xlabel, 155
value, pass by, 214 xor, 113
Van der Pol’s equation, 351
varargin, 215, 242
varargout, 242
Y
ylabel, 155
variable, 7, 20, 23
global, 212
hides script of same Z
name, 65 Zeller’s congruence, 151
persistent, 212 zero of a function, 325
scope, 212 zeros, 133
string, 143 zlabel, 163
termed arrays by MATLAB, 24 zoom, 350

You might also like