>> help HELP topics: matlab/general - General purpose commands. matlab/ops - Operators and special characters. matlab/lang - Programming language constructs. matlab/elmat - Elementary matrices and matrix manipulation. matlab/elfun - Elementary math functions. matlab/specfun - Specialized math functions. matlab/matfun - Matrix functions - numerical linear algebra. matlab/datafun - Data analysis and Fourier transforms. matlab/polyfun - Interpolation and polynomials. matlab/funfun - Function functions and ODE solvers. matlab/sparfun - Sparse matrices. matlab/graph2d - Two dimensional graphs. matlab/graph3d - Three dimensional graphs. matlab/specgraph - Specialized graphs. matlab/graphics - Handle Graphics. matlab/uitools - Graphical user interface tools. matlab/strfun - Character strings. matlab/iofun - File input/output. matlab/timefun - Time and dates. matlab/datatypes - Data types and structures. matlab/demos - Examples and demonstrations. simulink/simulink - Simulink simulink/blocks - Simulink block library. simulink/simdemos - Simulink demonstrations and samples. simulink/dee - Differential Equation Editor toolbox/compiler - MATLAB Compiler toolbox/control - Control System Toolbox. control/obsolete - (No table of contents file) finance/finance - Financial Toolbox. finance/calendar - Financial Toolbox calendar functions. finance/findemos - Financial Toolbox demonstration functions. toolbox/ident - System Identification Toolbox. images/images - Image Processing Toolbox. images/imdemos - Image Processing Toolbox --- demos and sample images toolbox/local - Preferences. mutools/commands - Mu-Analysis and Synthesis Toolbox. mutools/subs - Mu-Analysis and Synthesis Toolbox. nnet/nnet - Neural Network Toolbox. nnet/nndemos - Neural Network Demonstrations. nnet/nnutils - (No table of contents file) nnet/nnobsolete - (No table of contents file) toolbox/optim - Optimization Toolbox. toolbox/pde - Partial Differential Equation Toolbox. toolbox/robust - Robust Control Toolbox. toolbox/signal - Signal Processing Toolbox. stateflow/stateflow - Stateflow stateflow/sfdemos - (No table of contents file) toolbox/stats - Statistics Toolbox. toolbox/tour - MATLAB Tour wavelet/wavelet - Wavelet Toolbox. wavelet/wavedemo - Wavelet Toolbox Demos. For more help on directory/topic, type "help topic". >> help general General purpose commands. MATLAB Toolbox Version 5.2 18-Dec-1997 General information help - On-line help, display text at command line. helpwin - On-line help, separate window for navigation. helpdesk - Comprehensive hypertext documentation and troubleshooting. demo - Run demonstrations. ver - MATLAB, SIMULINK, and toolbox version information. whatsnew - Display Readme files. Readme - What's new in MATLAB 5.1 Managing the workspace. who - List current variables. whos - List current variables, long form. clear - Clear variables and functions from memory. pack - Consolidate workspace memory. load - Load workspace variables from disk. save - Save workspace variables to disk. quit - Quit MATLAB session. Managing commands and functions. what - List MATLAB-specific files in directory. type - List M-file. edit - Edit M-file. lookfor - Search all M-files for keyword. which - Locate functions and files. pcode - Create pre-parsed pseudo-code file (P-file). inmem - List functions in memory. mex - Compile MEX-function. Managing the search path path - Get/set search path. addpath - Add directory to search path. rmpath - Remove directory from search path. editpath - Modify search path. Controlling the command window. echo - Echo commands in M-files. more - Control paged output in command window. diary - Save text of MATLAB session. format - Set output format. Operating system commands cd - Change current working directory. copyfile - Copy a file. pwd - Show (print) current working directory. dir - List directory. delete - Delete file. getenv - Get environment variable. mkdir - Make directory. ! - Execute operating system command (see PUNCT). dos - Execute DOS command and return result. unix - Execute UNIX command and return result. vms - Execute VMS DCL command and return result. web - Open Web browser on site or files. computer - Computer type. Debugging M-files. debug - List debugging commands. dbstop - Set breakpoint. dbclear - Remove breakpoint. dbcont - Continue execution. dbdown - Change local workspace context. dbstack - Display function call stack. dbstatus - List all breakpoints. dbstep - Execute one or more lines. dbtype - List M-file with line numbers. dbup - Change local workspace context. dbquit - Quit debug mode. dbmex - Debug MEX-files (UNIX only). Profiling M-files. profile - Profile M-file execution time. See also PUNCT. >> help ops Operators and special characters. Arithmetic operators. plus - Plus + uplus - Unary plus + minus - Minus - uminus - Unary minus - mtimes - Matrix multiply * times - Array multiply .* mpower - Matrix power ^ power - Array power .^ mldivide - Backslash or left matrix divide \ mrdivide - Slash or right matrix divide / ldivide - Left array divide .\ rdivide - Right array divide ./ kron - Kronecker tensor product kron Relational operators. eq - Equal == ne - Not equal ~= lt - Less than < gt - Greater than > le - Less than or equal <= ge - Greater than or equal >= Logical operators. and - Logical AND & or - Logical OR | not - Logical NOT ~ xor - Logical EXCLUSIVE OR any - True if any element of vector is nonzero all - True if all elements of vector are nonzero Special characters. colon - Colon : paren - Parentheses and subscripting ( ) paren - Brackets [ ] paren - Braces and subscripting { } punct - Decimal point . punct - Structure field access . punct - Parent directory .. punct - Continuation ... punct - Separator , punct - Semicolon ; punct - Comment % punct - Invoke operating system command ! punct - Assignment = punct - Quote ' transpose - Transpose .' ctranspose - Complex conjugate transpose ' horzcat - Horizontal concatenation [,] vertcat - Vertical concatenation [;] subsasgn - Subscripted assignment ( ),{ },. subsref - Subscripted reference ( ),{ },. subsindex - Subscript index Bitwise operators. bitand - Bit-wise AND. bitcmp - Complement bits. bitor - Bit-wise OR. bitmax - Maximum floating point integer. bitxor - Bit-wise XOR. bitset - Set bit. bitget - Get bit. bitshift - Bit-wise shift. Set operators. union - Set union. unique - Set unique. intersect - Set intersection. setdiff - Set difference. setxor - Set exclusive-or. ismember - True for set member. See also ARITH, RELOP, SLASH. >> help lang Programming language constructs. Control flow. if - Conditionally execute statements. else - IF statement condition. elseif - IF statement condition. end - Terminate scope of FOR, WHILE, SWITCH, TRY and IF statements. for - Repeat statements a specific number of times. while - Repeat statements an indefinite number of times. break - Terminate execution of WHILE or FOR loop. switch - Switch among several cases based on expression. case - SWITCH statement case. otherwise - Default SWITCH statement case. try - Begin TRY block. catch - Begin CATCH block. return - Return to invoking function. Evaluation and execution. eval - Execute string with MATLAB expression. feval - Execute function specified by string. evalin - Evaluate expression in workspace. builtin - Execute built-in function from overloaded method. assignin - Assign variable in workspace. run - Run script. Scripts, functions, and variables. script - About MATLAB scripts and M-files. function - Add new function. global - Define global variable. persistent - Define persistent variable. mfilename - Name of currently executing M-file. lists - Comma separated lists. exist - Check if variables or functions are defined. isglobal - True for global variables. mlock - Prevent M-file from being cleared. munlock - Allow M-file to be cleared. mislocked - True if M-file cannot be cleared. Argument handling. nargchk - Validate number of input arguments. nargin - Number of function input arguments. nargout - Number of function output arguments. varargin - Variable length input argument list. varargout - Variable length output argument list. inputname - Input argument name. Message display. error - Display error message and abort function. warning - Display warning message. lasterr - Last error message. lastwarn - Last warning message. errortrap - Skip error during testing. disp - Display an array. fprintf - Display formatted message. sprintf - Write formatted data to a string. Interactive input. input - Prompt for user input. keyboard - Invoke keyboard from M-file. pause - Wait for user response. uimenu - Create user interface menu. uicontrol - Create user interface control. >> help if IF IF statement condition. The general form of the IF statement is IF expression statements ELSEIF expression statements ELSE statements END The statements are executed if the real part of the expression has all non-zero elements. The ELSE and ELSEIF parts are optional. Zero or more ELSEIF parts can be used as well as nested IF's. The expression is usually of the form expr rop expr where rop is ==, <, >, <=, >=, or ~=. Example if I == J A(I,J) = 2; elseif abs(I-J) == 1 A(I,J) = -1; else A(I,J) = 0; end See also RELOP, ELSE, ELSEIF, END, FOR, WHILE, SWITCH. >> help lookfor LOOKFOR Search all M-files for keyword. LOOKFOR XYZ looks for the string XYZ in the first comment line (the H1 line) of the HELP text in all M-files found on MATLABPATH. For all files in which a match occurs, LOOKFOR displays the H1 line. For example, "lookfor inverse" finds at least a dozen matches, including the H1 lines containing "inverse hyperbolic cosine" "two-dimensional inverse FFT", and "pseudoinverse". Contrast this with "which inverse" or "what inverse", which run more quickly, but which probably fail to find anything because MATLAB does not ordinarily have a function "inverse". LOOKFOR XYZ -all searches the entire first comment block of each M-file. In summary, WHAT lists the functions in a given directory, WHICH finds the directory containing a given function or file, and LOOKFOR finds all functions in all directories that might have something to do with a given key word. See also DIR, HELP, WHO, WHAT, WHICH. >> helpdesk To learn how to configure your Web browser type 'help docopt' >> >> >> >> >> 2*3 ans = 6 >> 2*3, x=5 ans = 6 x = 5 >> x^2 ans = 25 >> >> A = [1 2 3;4 5 6;7 8 9] A = 1 2 3 4 5 6 7 8 9 >> x = [1 2 3] x = 1 2 3 >> y = [1 2 3]' y = 1 2 3 >> y = [1;2;3] y = 1 2 3 >> x*A*y ans = 228 >> 5*A ans = 5 10 15 20 25 30 35 40 45 >> A^2 ans = 30 36 42 66 81 96 102 126 150 >> A' ans = 1 4 7 2 5 8 3 6 9 >> A^(1/2) ans = Column 1 4.497563634973735e-01 + 7.622786055648265e-01i 1.018520732738715e+00 + 8.415135842171750e-02i 1.587285101980056e+00 - 5.939758603553980e-01i Column 2 5.526217397721793e-01 + 2.067958431205032e-01i 1.251470229221984e+00 + 2.282914443831942e-02i 1.950318718671787e+00 - 1.611376109758565e-01i Column 3 6.554871160469855e-01 - 3.486868909578253e-01i 1.484419725705253e+00 - 3.849312627707034e-02i 2.313352335363519e+00 + 2.717006667696813e-01i >> B = [ 1 0 1; 0 1 0; 1 0 1]; >> A*B ans = 4 2 4 10 5 10 16 8 16 >> A.*B ans = 1 0 3 0 5 0 7 0 9 >> C = A.*B; >> sin(C) ans = 8.414709848078965e-01 0 1.411200080598672e-01 0 -9.589242746631385e-01 0 6.569865987187891e-01 0 4.121184852417566e-01 >> help elmat Elementary matrices and matrix manipulation. Elementary matrices. zeros - Zeros array. ones - Ones array. eye - Identity matrix. repmat - Replicate and tile array. rand - Uniformly distributed random numbers. randn - Normally distributed random numbers. linspace - Linearly spaced vector. logspace - Logarithmically spaced vector. meshgrid - X and Y arrays for 3-D plots. : - Regularly spaced vector and index into matrix. Basic array information. size - Size of matrix. length - Length of vector. ndims - Number of dimensions. disp - Display matrix or text. isempty - True for empty matrix. isequal - True if arrays are identical. isnumeric - True for numeric arrays. islogical - True for logical array. logical - Convert numeric values to logical. Matrix manipulation. reshape - Change size. diag - Diagonal matrices and diagonals of matrix. tril - Extract lower triangular part. triu - Extract upper triangular part. fliplr - Flip matrix in left/right direction. flipud - Flip matrix in up/down direction. flipdim - Flip matrix along specified dimension. rot90 - Rotate matrix 90 degrees. : - Regularly spaced vector and index into matrix. find - Find indices of nonzero elements. end - Last index. sub2ind - Linear index from multiple subscripts. ind2sub - Multiple subscripts from linear index. Special variables and constants. ans - Most recent answer. eps - Floating point relative accuracy. realmax - Largest positive floating point number. realmin - Smallest positive floating point number. pi - 3.1415926535897.... i, j - Imaginary unit. inf - Infinity. NaN - Not-a-Number. isnan - True for Not-a-Number. isinf - True for infinite elements. isfinite - True for finite elements. flops - Floating point operation count. why - Succinct answer. Specialized matrices. compan - Companion matrix. gallery - Higham test matrices. hadamard - Hadamard matrix. hankel - Hankel matrix. hilb - Hilbert matrix. invhilb - Inverse Hilbert matrix. magic - Magic square. pascal - Pascal matrix. rosser - Classic symmetric eigenvalue test problem. toeplitz - Toeplitz matrix. vander - Vandermonde matrix. wilkinson - Wilkinson's eigenvalue test matrix. >> help elfun Elementary math functions. Trigonometric. sin - Sine. sinh - Hyperbolic sine. asin - Inverse sine. asinh - Inverse hyperbolic sine. cos - Cosine. cosh - Hyperbolic cosine. acos - Inverse cosine. acosh - Inverse hyperbolic cosine. tan - Tangent. tanh - Hyperbolic tangent. atan - Inverse tangent. atan2 - Four quadrant inverse tangent. atanh - Inverse hyperbolic tangent. sec - Secant. sech - Hyperbolic secant. asec - Inverse secant. asech - Inverse hyperbolic secant. csc - Cosecant. csch - Hyperbolic cosecant. acsc - Inverse cosecant. acsch - Inverse hyperbolic cosecant. cot - Cotangent. coth - Hyperbolic cotangent. acot - Inverse cotangent. acoth - Inverse hyperbolic cotangent. Exponential. exp - Exponential. log - Natural logarithm. log10 - Common (base 10) logarithm. log2 - Base 2 logarithm and dissect floating point number. pow2 - Base 2 power and scale floating point number. sqrt - Square root. nextpow2 - Next higher power of 2. Complex. abs - Absolute value. angle - Phase angle. conj - Complex conjugate. imag - Complex imaginary part. real - Complex real part. unwrap - Unwrap phase angle. isreal - True for real array. cplxpair - Sort numbers into complex conjugate pairs. Rounding and remainder. fix - Round towards zero. floor - Round towards minus infinity. ceil - Round towards plus infinity. round - Round towards nearest integer. mod - Modulus (signed remainder after division). rem - Remainder after division. sign - Signum. >> help matfun Matrix functions - numerical linear algebra. Matrix analysis. norm - Matrix or vector norm. normest - Estimate the matrix 2-norm. rank - Matrix rank. det - Determinant. trace - Sum of diagonal elements. null - Null space. orth - Orthogonalization. rref - Reduced row echelon form. subspace - Angle between two subspaces. Linear equations. \ and / - Linear equation solution; use "help slash". inv - Matrix inverse. cond - Condition number with respect to inversion. condest - 1-norm condition number estimate. chol - Cholesky factorization. cholinc - Incomplete Cholesky factorization. lu - LU factorization. luinc - Incomplete LU factorization. qr - Orthogonal-triangular decomposition. nnls - Non-negative least-squares. pinv - Pseudoinverse. lscov - Least squares with known covariance. Eigenvalues and singular values. eig - Eigenvalues and eigenvectors. svd - Singular value decomposition. gsvd - Generalized ingular value decomposition. eigs - A few eigenvalues. svds - A few singular values. poly - Characteristic polynomial. polyeig - Polynomial eigenvalue problem. condeig - Condition number with respect to eigenvalues. hess - Hessenberg form. qz - QZ factorization for generalized eigenvalues. schur - Schur decomposition. Matrix functions. expm - Matrix exponential. logm - Matrix logarithm. sqrtm - Matrix square root. funm - Evaluate general matrix function. Factorization utilities qrdelete - Delete column from QR factorization. qrinsert - Insert column in QR factorization. rsf2csf - Real block diagonal form to complex diagonal form. cdf2rdf - Complex diagonal form to real block diagonal form. balance - Diagonal scaling to improve eigenvalue accuracy. planerot - Given's plane rotation. cholupdate - rank 1 update to Cholesky factorization. qrupdate - rank 1 update to QR factorization. >> >> >> >> >> >> A A = 1 2 3 4 5 6 7 8 9 >> A = [ 2 1 0; 2 1 2; 0 1 2] A = 2 1 0 2 1 2 0 1 2 >> A = [ 2 1 0; 1 2 1; 0 1 2] A = 2 1 0 1 2 1 0 1 2 >> b = [0;0;1] b = 0 0 1 >> y = A\b y = 2.500000000000001e-01 -5.000000000000002e-01 7.500000000000001e-01 >> A*y ans = -1.110223024625157e-16 -3.330669073875470e-16 1.000000000000000e+00 >> inv(A) ans = 7.500000000000000e-01 -4.999999999999999e-01 2.499999999999999e-01 -4.999999999999999e-01 9.999999999999999e-01 -4.999999999999999e-01 2.499999999999999e-01 -4.999999999999999e-01 7.499999999999999e-01 >> eig(A) ans = 3.414213562373095e+00 2.000000000000000e+00 5.857864376269051e-01 >> [V,S] = eig(A) V = 5.000000000000002e-01 -7.071067811865477e-01 -4.999999999999999e-01 7.071067811865475e-01 1.110223024625157e-16 7.071067811865474e-01 4.999999999999999e-01 7.071067811865475e-01 -4.999999999999999e-01 S = 3.414213562373095e+00 0 0 0 2.000000000000000e+00 0 0 0 5.857864376269051e-01 >> >> >> >> >> >> diary off