Books in black and white
 Books Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics

# A Guide to MATLAB for Beginners and Experienced Users - Brian R.H.

Brian R.H., Roland L.L. A Guide to MATLAB for Beginners and Experienced Users - Cambrige, 2001. - 346 p. Previous << 1 .. 78 79 80 81 82 83 < 84 > 85 86 87 88 89 90 .. 91 >> Next fminbnd Finds the smallest (approximate) value of a function over an interval. fminbnd('x~4 - x~2 + 1', 0, 1)

f = inline('x~3 - 7*x~2 - 5*x + 2', 'x'); fminbnd(f, 4, 6)

format Specifies the output format for numerical variables. format long

fzero Tries to find a zero of the specified function near a given starting point or on a specified interval.

fzero(inline('cos(x) - x'), 1) fzero(@cos, [-pi 0])

guide Opens the GUI Design Environment. guide mygui

inline Constructs a MATLAB inline function from a string expression. f = inline('x~5 - x'); f(3)

sol = dsolve('Dy = x~2 + y', 'y(0) = 2', 'x'); fsol = inline(vectorize(sol), 'x')

int Integration operator for both definite and indefinite integrals.

int('1/(1 + xA2)', 'x')

syms x; int(exp(-x), x, 0, Inf)

inv Inverse of a square matrix. inv([1 2; 3 5])

jacobian Computes the Jacobian matrix, or for a scalar function, the symbolic gradient.

syms x y; f = x~2*y~3; jacobian(f) 306 Glossary

length Returns the number of elements in a vector or string. length('abcde')

limit Finds a two-sided limit, if it exists. Use 'right' or 'left' for one-sided limits.

syms x; limit(sin(x)/x, x, 0) syms x; limit(1/x, x, Inf, 'left')

linspace Generates a vector of linearly spaced points.

lookfor Searches for a specified string in the first line of all M-files found in the MATLAB path. lookfor ode

ls Lists files in the current working directory. Similar to dir.

maple String access to the Maple kernel; generally is used in the form maple('function', 'arg'). Not available in the Student Version.

maple('help', 'csgn') max Computes the arithmetic maximum of the entries of a vector.

X= [3 5 1 -6 23 -56 100]; max(X) mean Computes the arithmetic average of the entries of a vector.

X= [3 5 1 -6 23 -56 100]; mean(X) syms xyz; X= [xyz]; mean(X)

median Computes the arithmetic median of the entries of a vector. X= [3 5 1 -6 23 -56 100]; median(X)

min Computes the arithmetic minimum of the entries of a vector. X= [3 5 1 -6 23 -56 100]; min(X)

more Turns on (or off) page-by-page scrolling of MATLAB output. Use the SPACE BAR to advance to the next page, the RETURN key to advance line-by-line, and Q to abort the output.

more on more off

notebook Opens an M-book (Windows only). notebook problem1.doc notebook -setup Glossary 307

num2str Converts a number to a string. Useful in programming. constant = ['a' num2str(1)]

ode4 5 Numerical ODE solver for first-order equations. See MATLAB's online help for ode4 5 for a list of other MATLAB ODE solvers. f = inline('t~2 + y', 't', 'y') [x, y] = ode4 5(f, [0 10], 1); plot(x, y)

ones Creates a matrix of ones. ones(3) ones(3, 1)

open Opens a file. The way this is done depends on the filename extension. open myfigure.fig

path Without an argument, displays the search path. With an argument, sets the search path. Type help path for details.

pretty Displays a symbolic expression in a more readable format.

syms x y; expr = x/(x - 3)/(x + 2/y) pretty(expr)

prod Computes the product of the entries of a vector. X= [3 5 1 -6 23 -56 100]; prod(X)

pwd Shows the name of the current (working) directory.

quit Terminates a MATLAB session.

rand Random number generator; gives a random number between 0 and 1.

rank Gives the rank of a matrix. A= [2 3 5; 4 6 8]; rank(A)

roots Finds the roots of a polynomial whose coefficients are given by the elements of the vector argument of roots.

roots([1 2 2]) round Rounds a number to the nearest integer.

save Saves Workspace variables to a specified file. See also diary and load. save filename 308 Glossary

sim Runs a SIMULINK model. sim('model')

simple Attempts to simplify an expression using multiple methods.

syms x y;[expression, how] =simple(sin(x)*cos(y) +cos(x)*sin(y)) simplify Attempts to simplify an expression symbolically. syms x; simplify(1/(1 + x)~2 - 1/(1 - x)~2)

size Returns the number of rows and the number of columns in a matrix.

A= [1 3 2; 4 1 5] [r, c] = size(A)

solve Solves an equation or set of equations. If the right-hand side of the equation is omitted, '0' is assumed.

solve('2*x~2 - 3*x + 6')

[x, y] = solve('x + 3*y = 4', '-x - 5*y = 3', 'x', 'y')

sound Plays a vector through the computer speakers.

sound(sin(0:0.1*pi:1000*pi)) strcat Concatenates two or more strings.

strcat('This ', 'is ', 'a ', 'long ', 'string.') str2num Converts a string to a number. Useful in programming.

constant = 'a7'

index = str2num(constant(2))

subs Substitutes for parts of an expression.

subs('x~3 - 4*x + 1', 'x', 2) subs('sin(x)~2 + cos(x)', 'sin(x)', 'z') Previous << 1 .. 78 79 80 81 82 83 < 84 > 85 86 87 88 89 90 .. 91 >> Next 