You are on page 1of 7

BTE4225

There are many Matlab features which cannot be included in these introductory notes. Listed below are some of the Matlab functions and operators available, rouped by sub!ect area "#ource$ Matlab %ser&s 'uide, version (.5). %se the on*line help facility or consult the %ser&s 'uide for more detailed information on the functions. There are many functions beyond these. There e+ist, in particular, several ,toolbo+es, of functions for specific areas- included amon such are si nal processin , control systems, robust*control, system identification, optimi.ation, splines, chemometrics, mu*analysis and synthesis, state*space identification, and neural networ/s. "The toolbo+es, which are optional, may not be installed on your system.) These can be e+plored via the command help.
help demo who what size length clear computer ^C exit quit help facility run demonstrations list variables in memory list M-files on disk row and column dimensions vector length clear workspace type of computer local abort exit Matlab same as exit

Matri+01rray 2perators
Matrix Operators rray Operators --------------------------------------------------! addition ! addition subtraction subtraction " multiplication #" multiplication $ right division #$ right division % left division #% left division ^ power #^ power & con'ugate transpose #& transpose

3elational and Lo ical 2perators


( () * *) )) +) , +

less than less than or equal greater than greater than or equal equal not equal and or not

#pecial 4haracters
) assignment statement

. / 0 1 # ### 2 3 4 5 6

used to form vectors and matrices see . arithmetic expression precedence see 0 decimal point continue statement to next line separate subscripts and function arguments end rows2 suppress printing comments subscripting2 vector generation execute operating system command

#pecial 5alues
ans eps pi i2 ' inf 8a8 clock date flops nargin nargout

answer when expression not assigned floating point precision pi sqrt0-71 infinity 8ot-a-8umber wall clock date floating point operation count number of function input arguments number of function output arguments

6is/ 7iles
chdir delete diary dir load save type what fprintf pack change current directory delete file diary of the session directory of files on disk load variables from file save variables to file list function or file show M-files on disk write to a file compact memory via save

#pecial Matrices
compan diag eye gallery hadamard hankel hilb invhilb linspace logspace magic meshdom ones pascal rand toeplitz vander companion diagonal identity esoteric 9adamard 9ankel 9ilbert inverse 9ilbert linearly spaced vectors logarithmically spaced vectors magic square domain for mesh points constant :ascal random elements ;oeplitz <andermonde

zeros

zero

Matri+ Manipulation
rot=> fliplr flipud diag tril triu reshape #& 5

rotation flip matrix left-to-right flip matrix up-to-down diagonal matrices lower triangular part upper triangular part reshape transpose convert matrix to single column3

051

3elational and Lo ical 7unctions


any all find isnan finite isempty isstr strcmp logical conditions logical conditions find array indices of logical values detect 8a8s detect infinities detect empty matrices detect string variables compare string variables

4ontrol 7low
if elseif else end for while break return pause conditionally execute statements used with if used with if terminate bif2 for2 while repeat statements a number of times do while break out of for and while loops return from functions pause until key pressed

8ro rammin and M*files


input keyboard error function eval feval echo exist casesen global startup getenv menu etime

get numbers from keyboard call keyboard as M-file display error message define function interpret text in variables evaluate function given by string enable command echoing check if variables exist set case sensitivity define global variables startup M-file get environment string select item from menu elapsed time

Te+t and #trin s


abs

convert string to

?C@@ values

eval numAstr intAstr setstr sprintf isstr strcomp hexAnum

evaluate text macro convert number to string convert integer to string set flag indicating matrix is a string convert number to string detect string variables compare string variables convert hex string to number

4ommand 9indow
clc home format disp fprintf echo clear command screen move cursor home set output display format display matrix or text print formatted number enable command echoing

'raph 8aper
plot loglog semilogx semilogy polar mesh contour meshdom bar stairs errorbar linear B-C plot loglog B-C plot semi-log B-C plot semi-log B-C plot polar plot D-dimensional mesh surface contour plot domain for mesh plots bar charts stairstep graph add error bars

'raph 1nnotation
title xlabel ylabel grid text gtext ginput

plot title x-axis label y-axis label draw grid lines arbitrarily position text mouse-positioned text graphics input

'raph 9indow 4ontrol


axis hold shg clg subplot manual axis scaling hold plot on screen show graph window clear graph window split graph window

'raph 9indow :ardcopy


print prtsc meta

send graph to printer screen dump graphics metafile

Elementary Math 7unctions


abs absolute value or complex magnitude

angle sqrt real imag con' round fix floor ceil sign rem exp log log7>

phase angle square root real part imaginary part complex con'ugate round to nearest integer round toward zero round toward -infinity round toward infinity signum function remainder exponential base e natural logarithm log base 7>

Tri onometric 7unctions


sin cos tan asin acos atan atanA sinh cosh tanh asinh acosh atanh sine cosine tangent arcsine arccosine arctangent four quadrant arctangent hyperbolic sine hyperbolic cosine hyperbolic tangent hyperbolic arcsine hyperbolic arccosine hyperbolic arctangent

#pecial 7unctions
bessel gamma rat erf inverf ellipk ellip'

bessel function gamma function rational approximation error function inverse error function complete elliptic integral of first kind Eacobian elliptic integral

6ecompositions and 7actori.ations


balance backsub cdfArdf chol eig hess inv lu nnls null orth pinv qr qz rref balanced form backsubstitution convert complex-diagonal to real-diagonal Cholesky factorization eigenvalues and eigenvectors 9essenberg form inverse factors from Faussian elimination nonnegative least squares null space orthogonalization pseudoinverse orthogonal-triangular decomposition GH algorithm reduced row echelon form

schur svd

?chur decomposition singular value decomposition

Matri+ 4onditionin
cond norm rank rcond condition number in A-norm 7-norm2A-norm2I-norm2 infinity-norm rank condition estimate 0reciprocal1

Elementary Matri+ 7unctions


expm logm sqrtm funm poly det trace kron matrix exponential matrix logarithm matrix square root arbitrary matrix function characteristic polynomial determinant trace Jronecker tensor product

8olynomials
poly roots roots7 polyval polyvalm conv deconv residue polyfit characteristic polynomial polynomial roots---companion matrix method polynomial roots---Kaguerre&s method polynomial evaluation matrix polynomial evaluation multiplication division partial-fraction expansion polynomial curve fitting

4olumn*wise 6ata 1nalysis


max min mean median std sort sum prod cumsum cumprod diff hist corrcoef cov cplxpair

maximum value minimum value mean value median value standard deviation sorting sum of elements product of elements cumulative sum of elements cumulative product of elements approximate derivatives histograms correlation coefficients covariance matrix reorder into complex pairs

#i nal 8rocessin
abs angle conv corrcoef cov deconv complex magnitude phase angle convolution correlation coefficients covariance deconvolution

fft fftA ifft ifftA fftshift

radix-A fast Iourier transform two-dimensional II; inverse fast Iourier transform inverse A-L II; II; rearrangement

;umerical <nte ration


quad quadM

numerical function integration numerical function integration

6ifferential E=uation #olution


odeAD odeOP

And$Drd order Nunge-Jutta method Oth$Pth order Nunge-Jutta-Iehlberg method

;onlinear E=uations and 2ptimi.ation


fmin fmins fsolve fzero

minimum of a function of one variable minimum of a multivariable function solution of a system of nonlinear equations 0zeros of a multivariable function1 zero of a function of one variable

<nterpolation
spline table7 tableA cubic spline 7-L table look-up A-L table look-up