help HELP topics: Documents/MATLAB - (No table of contents file) matlab/demos - Examples. matlab/graph2d - Two dimensional graphs. matlab/graph3d - Three dimensional graphs. matlab/graphics - Handle Graphics. graphics/obsolete - (No table of contents file) matlab/plottools - Graphical plot editing tools matlab/scribe - Annotation and Plot Editing. scribe/obsolete - (No table of contents file) matlab/specgraph - Specialized graphs. matlab/uitools - Graphical user interface components and tools uitools/obsolete - (No table of contents file) hardware/stubs - (No table of contents file) matlab/images - (No table of contents file) toolbox/local - General preferences and configuration information. matlab/optimfun - Optimization and root finding. matlab/codetools - Commands for creating and debugging code matlab/datafun - Data analysis and Fourier transforms. matlab/datamanager - (No table of contents file) matlab/datastoreio - (No table of contents file) matlab/datatypes - Data types and structures. matlab/elfun - Elementary math functions. matlab/elmat - Elementary matrices and matrix manipulation. matlab/funfun - Function functions and ODE solvers. matlab/general - General purpose commands. matlab/guide - Graphical user interface design environment matlab/helptools - Help commands. matlab/iofun - File input and output. matlab/lang - Programming language constructs. matlab/mapreduceio - (No table of contents file) matlab/matfun - Matrix functions - numerical linear algebra. matlab/ops - Operators and special characters. matlab/polyfun - Interpolation and polynomials. matlab/randfun - Random matrices and random streams. matlab/sparfun - Sparse matrices. matlab/specfun - Specialized math functions. matlab/strfun - Character strings. matlab/testframework - (No table of contents file) matlab/timefun - Time and dates. matlab/verctrl - Version control. matlab/apps - (No table of contents file) matlab/audiovideo - Audio and Video support. shared/comparisons - (No table of contents file) connector/connector - connector Enable or disable the MATLAB Connector. The MATLAB Connector allows you to access a MATLAB session on a desktop from a mobile device using MATLAB Mobile. hdllib/ml_lib - (No table of contents file) matlab/imagesci - (No table of contents file) shared/instrument - (No table of contents file) shared/m3i - (No table of contents file) matlab/networklib - Network support. interfaces/python - (No table of contents file) controllib/general - Control System Toolbox -- General Utilities. controllib/graphics - Control Library - Graphics. graphics/utils - (No table of contents file) graphics/plotoptions - (No table of contents file) shared/dastudio - (No table of contents file) shared/rptgen - (No table of contents file) matlab/timeseries - Time series data visualization and exploration. matlab/hds - (No table of contents file) matlab/toolbox_packaging - (No table of contents file) matlab/webcam - Webcam support. webservices/restful - (No table of contents file) interfaces/webservices - Web services interface. help elfun Elementary math functions. Trigonometric. sin - Sine. sind - Sine of argument in degrees. sinh - Hyperbolic sine. asin - Inverse sine. asind - Inverse sine, result in degrees. asinh - Inverse hyperbolic sine. cos - Cosine. cosd - Cosine of argument in degrees. cosh - Hyperbolic cosine. acos - Inverse cosine. acosd - Inverse cosine, result in degrees. acosh - Inverse hyperbolic cosine. tan - Tangent. tand - Tangent of argument in degrees. tanh - Hyperbolic tangent. atan - Inverse tangent. atand - Inverse tangent, result in degrees. atan2 - Four quadrant inverse tangent. atan2d - Four quadrant inverse tangent, result in degrees. atanh - Inverse hyperbolic tangent. sec - Secant. secd - Secant of argument in degrees. sech - Hyperbolic secant. asec - Inverse secant. asecd - Inverse secant, result in degrees. asech - Inverse hyperbolic secant. csc - Cosecant. cscd - Cosecant of argument in degrees. csch - Hyperbolic cosecant. acsc - Inverse cosecant. acscd - Inverse cosecant, result in degrees. acsch - Inverse hyperbolic cosecant. cot - Cotangent. cotd - Cotangent of argument in degrees. coth - Hyperbolic cotangent. acot - Inverse cotangent. acotd - Inverse cotangent, result in degrees. acoth - Inverse hyperbolic cotangent. hypot - Square root of sum of squares. Exponential. exp - Exponential. expm1 - Compute exp(x)-1 accurately. log - Natural logarithm. log1p - Compute log(1+x) accurately. log10 - Common (base 10) logarithm. log2 - Base 2 logarithm and dissect floating point number. pow2 - Base 2 power and scale floating point number. realpow - Power that will error out on complex result. reallog - Natural logarithm of real number. realsqrt - Square root of number greater than or equal to zero. sqrt - Square root. nthroot - Real n-th root of real numbers. nextpow2 - Next higher power of 2. Complex. abs - Absolute value. angle - Phase angle. complex - Construct complex data from real and imaginary parts. 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 floor floor Round towards minus infinity. floor(X) rounds the elements of X to the nearest integers towards minus infinity. See also round, ceil, fix. Other functions named floor Reference page in Help browser doc floor doc plot j = (3+5)*6 j = 48 j = -4; h = 100 h = 100 j = -4, a = -3, h = 100 j = -4 a = -3 h = 100 pi ans = 3.1416 format long pi ans = 3.141592653589793 help format format Set output format. format with no inputs sets the output format to the default appropriate for the class of the variable. For float variables, the default is format SHORT. format does not affect how MATLAB computations are done. Computations on float variables, namely single or double, are done in appropriate floating point precision, no matter how those variables are displayed. Computations on integer variables are done natively in integer. Integer variables are always displayed to the appropriate number of digits for the class, for example, 3 digits to display the INT8 range -128:127. format SHORT and LONG do not affect the display of integer variables. format may be used to switch between different output display formats of all float variables as follows: format SHORT Scaled fixed point format with 5 digits. format LONG Scaled fixed point format with 15 digits for double and 7 digits for single. format SHORTE Floating point format with 5 digits. format LONGE Floating point format with 15 digits for double and 7 digits for single. format SHORTG Best of fixed or floating point format with 5 digits. format LONGG Best of fixed or floating point format with 15 digits for double and 7 digits for single. format SHORTENG Engineering format that has at least 5 digits and a power that is a multiple of three format LONGENG Engineering format that has exactly 16 significant digits and a power that is a multiple of three. format may be used to switch between different output display formats of all numeric variables as follows: format HEX Hexadecimal format. format + The symbols +, - and blank are printed for positive, negative and zero elements. Imaginary parts are ignored. format BANK Fixed format for dollars and cents. format RAT Approximation by ratio of small integers. Numbers with a large numerator or large denominator are replaced by *. format may be used to affect the spacing in the display of all variables as follows: format COMPACT Suppresses extra line-feeds. format LOOSE Puts the extra line-feeds back in. Example: format short, pi, single(pi) displays both double and single pi with 5 digits as 3.1416 while format long, pi, single(pi) displays pi as 3.141592653589793 and single(pi) as 3.1415927. format, intmax('uint64'), realmax shows these values as 18446744073709551615 and 1.7977e+308 while format hex, intmax('uint64'), realmax shows them as ffffffffffffffff and 7fefffffffffffff respectively. The HEX display corresponds to the internal representation of the value and is not the same as the hexadecimal notation in the C programming language. See also disp, display, isnumeric, isfloat, isinteger. Reference page in Help browser doc format pi ans = 3.141592653589793 pi = 4.0 pi = 4 clear('pi') pi ans = 3.141592653589793 i ans = 0.000000000000000 + 1.000000000000000i sqrt(-1) ans = 0.000000000000000 + 1.000000000000000i sqrt(-1) == i ans = 1 for i=1:10, i^3-i, end ans = 0 ans = 6 ans = 24 ans = 60 ans = 120 ans = 210 ans = 336 ans = 504 ans = 720 ans = 990 10 ans = 10 i i = 10 clear('i') M = [1 2 3 4] M = 1 2 3 4 M = [ 1,2,3,4 ] M = 1 2 3 4 vf = [ 1,2,3,4 ] vf = 1 2 3 4 v = [ 1,2,3,4 ] v = 1 2 3 4 whos('v') Name Size Bytes Class Attributes v 1x4 32 double v = [ 1; 2 v = [ 1; 2; 3; 4 ] v = 1 2 3 4 whos('v') Name Size Bytes Class Attributes v 4x1 32 double v v = 1 2 3 4 rand(4) ans = Columns 1 through 3 0.814723686393179 0.632359246225410 0.957506835434298 0.905791937075619 0.097540404999410 0.964888535199277 0.126986816293506 0.278498218867048 0.157613081677548 0.913375856139019 0.546881519204984 0.970592781760616 Column 4 0.957166948242946 0.485375648722841 0.800280468888800 0.141886338627215 v * rand(4) {Error using * Inner matrix dimensions must agree. } v' * rand(4) ans = Columns 1 through 3 3.954492423239911 4.317478051624238 6.679211242837675 Column 4 5.088412038708598 v' ans = 1 2 3 4 v v = 1 2 3 4 M = [ 1 2; 3 4 ] M = 1 2 3 4 whos('M') Name Size Bytes Class Attributes M 2x2 32 double A = [ M M ] A = 1 2 1 2 3 4 3 4 A = [ 1 2 3; 4 5 6 ] A = 1 2 3 4 5 6 B = [ A ; M M ] {Error using vertcat Dimensions of matrices being concatenated are not consistent. } B = [ A zeros(2,1) ; M M ] B = 1 2 3 0 4 5 6 0 1 2 1 2 3 4 3 4 B = [ A [ 0; 0 ] ; M M ] B = 1 2 3 0 4 5 6 0 1 2 1 2 3 4 3 4 B = [ A M ; M [0;0] M ] B = 1 2 3 1 2 4 5 6 3 4 1 2 0 1 2 3 4 0 3 4 rand(3) ans = 0.709364830858073 0.679702676853675 0.118997681558377 0.754686681982361 0.655098003973841 0.498364051982143 0.276025076998578 0.162611735194631 0.959743958516081 randn(3) ans = -0.769665913753682 1.117356138814467 0.552527021112224 0.371378812760058 -1.089064295052236 1.100610217880866 -0.225584402271252 0.032557464164973 1.544211895503951 randn(3,3) ans = 0.085931133175425 -1.061581733319986 0.748076783703985 -1.491590310637609 2.350457224002042 -0.192418510588264 -0.742301837259857 -0.615601881466894 0.888610425420721 randn(3,1) ans = -0.764849236567874 -1.402268969338759 -1.422375925091496 rand(1,5) ans = Columns 1 through 3 0.616044676146639 0.473288848902729 0.351659507062997 Columns 4 through 5 0.830828627896291 0.585264091152724 rand(2,3,4) ans(:,:,1) = 0.549723608291140 0.285839018820374 0.753729094278495 0.917193663829810 0.757200229110721 0.380445846975357 ans(:,:,2) = 0.567821640725221 0.053950118666607 0.779167230102011 0.075854289563064 0.530797553008973 0.934010684229183 ans(:,:,3) = 0.129906208473730 0.469390641058206 0.337122644398882 0.568823660872193 0.011902069501241 0.162182308193243 ans(:,:,4) = 0.794284540683907 0.528533135506213 0.601981941401637 0.311215042044805 0.165648729499781 0.262971284540144 zeros(4) ans = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 zeros(4,2) ans = 0 0 0 0 0 0 0 0 ones(20,1) ans = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 eye(4) ans = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 I = eye(4) I = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 A A = 1 2 3 4 5 6 M M = 1 2 3 4 M = [M M; M M] M = 1 2 1 2 3 4 3 4 1 2 1 2 3 4 3 4 whos('M') Name Size Bytes Class Attributes M 4x4 128 double whos('I') Name Size Bytes Class Attributes I 4x4 128 double I*M ans = 1 2 1 2 3 4 3 4 1 2 1 2 3 4 3 4 I.*M ans = 1 0 0 0 0 4 0 0 0 0 1 0 0 0 0 4 diag(M) ans = 1 4 1 4 diag([1 4 1 4]) ans = 1 0 0 0 0 4 0 0 0 0 1 0 0 0 0 4 M M = 1 2 1 2 3 4 3 4 1 2 1 2 3 4 3 4 diag(diag(M)) == M.*I ans = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 diag(diag(M)) ans = 1 0 0 0 0 4 0 0 0 0 1 0 0 0 0 4 y = (diag(diag(M)) == M.*I) y = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 whos('y') Name Size Bytes Class Attributes y 4x4 16 logical whos('M') Name Size Bytes Class Attributes M 4x4 128 double 3:6 ans = 3 4 5 6 3.14:6.5 ans = Columns 1 through 3 3.140000000000000 4.140000000000001 5.140000000000001 Column 4 6.140000000000001 3:2:10 ans = 3 5 7 9 3:2.5:10 ans = 3.000000000000000 5.500000000000000 8.000000000000000 3:pi:10 ans = 3.000000000000000 6.141592653589793 9.283185307179586 30:-pi:10 ans = Columns 1 through 3 30.000000000000000 26.858407346410207 23.716814692820414 Columns 4 through 6 20.575222039230621 17.433629385640828 14.292036732051034 Column 7 11.150444078461241 M M = 1 2 1 2 3 4 3 4 1 2 1 2 3 4 3 4 B = reshape(1:24, 4, 6) B = 1 5 9 13 17 21 2 6 10 14 18 22 3 7 11 15 19 23 4 8 12 16 20 24 B(2,2) ans = 6 B(2,[2 3]) ans = 6 10 B([1 2],[2 3]) ans = 5 9 6 10 B(1:2, 2:3) ans = 5 9 6 10 1:4 == [1 2 3 4] ans = 1 1 1 1 B B = 1 5 9 13 17 21 2 6 10 14 18 22 3 7 11 15 19 23 4 8 12 16 20 24 B(1:2, 2:end) ans = 5 9 13 17 21 6 10 14 18 22 B(1:2, 2:2:end) ans = 5 13 21 6 14 22 B B = 1 5 9 13 17 21 2 6 10 14 18 22 3 7 11 15 19 23 4 8 12 16 20 24 B(3:-1:1, end:-2:1) ans = 23 15 7 22 14 6 21 13 5 clc B B = 1 5 9 13 17 21 2 6 10 14 18 22 3 7 11 15 19 23 4 8 12 16 20 24 B(3:-2:1, end:-2:1) ans = 23 15 7 21 13 5 B(3:-1:1, end:-2:1) ans = 23 15 7 22 14 6 21 13 5 B B = 1 5 9 13 17 21 2 6 10 14 18 22 3 7 11 15 19 23 4 8 12 16 20 24 B(2:4, 3:5) ans = 10 14 18 11 15 19 12 16 20 B(2:4, [3 4 5]) ans = 10 14 18 11 15 19 12 16 20 B(2:4, [4 4 4]) ans = 14 14 14 15 15 15 16 16 16 M M = 1 2 1 2 3 4 3 4 1 2 1 2 3 4 3 4 M(2,:) ans = 3 4 3 4 M(:,1) ans = 1 3 1 3 M(:,:) ans = 1 2 1 2 3 4 3 4 1 2 1 2 3 4 3 4 rand(3,2,4) ans(:,:,1) = 0.654079098476782 0.450541598502498 0.689214503140008 0.083821377996933 0.748151592823709 0.228976968716819 ans(:,:,2) = 0.913337361501670 0.538342435260057 0.152378018969223 0.996134716626885 0.825816977489547 0.078175528753184 ans(:,:,3) = 0.442678269775446 0.004634224134067 0.106652770180584 0.774910464711502 0.961898080855054 0.817303220653433 ans(:,:,4) = 0.868694705363510 0.259870402850654 0.084435845510910 0.800068480224308 0.399782649098896 0.431413827463545 B=rand(4,4) B = Columns 1 through 3 0.910647594429523 0.136068558708664 0.144954798223727 0.181847028302852 0.869292207640089 0.853031117721894 0.263802916521990 0.579704587365570 0.622055131485066 0.145538980384717 0.549860201836332 0.350952380892271 Column 4 0.513249539867053 0.401808033751942 0.075966691690842 0.239916153553658 M M = 1 2 1 2 3 4 3 4 1 2 1 2 3 4 3 4 clear('M') M {Undefined function or variable 'M'. } M(1,1)=pi M = 3.141592653589793 M(4,4)=-3 M = Columns 1 through 3 3.141592653589793 0 0 0 0 0 0 0 0 0 0 0 Column 4 0 0 0 -3.000000000000000 format short M M = 3.1416 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -3.0000 M = zeros(4,4); M(1,1)=pi; M(4,4)=-3; M M = 3.1416 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -3.0000 M = rand(4) M = 0.1233 0.0497 0.4893 0.1112 0.1839 0.9027 0.3377 0.7803 0.2400 0.9448 0.9001 0.3897 0.4173 0.4909 0.3692 0.2417 M(:) ans = 0.1233 0.1839 0.2400 0.4173 0.0497 0.9027 0.9448 0.4909 0.4893 0.3377 0.9001 0.3692 0.1112 0.7803 0.3897 0.2417 v = M(:) v = 0.1233 0.1839 0.2400 0.4173 0.0497 0.9027 0.9448 0.4909 0.4893 0.3377 0.9001 0.3692 0.1112 0.7803 0.3897 0.2417 whos('v') Name Size Bytes Class Attributes v 16x1 128 double doc : v = M'(:) v = M'(:) | {Error: Unbalanced or unexpected parenthesis or bracket. } v = M'(:) v = M'(:) | {Error: Unbalanced or unexpected parenthesis or bracket. } v = M(:)' v = Columns 1 through 7 0.1233 0.1839 0.2400 0.4173 0.0497 0.9027 0.9448 Columns 8 through 14 0.4909 0.4893 0.3377 0.9001 0.3692 0.1112 0.7803 Columns 15 through 16 0.3897 0.2417 v = M'(:) v = M'(:) | {Error: Unbalanced or unexpected parenthesis or bracket. } N = M'; N(:) ans = 0.1233 0.0497 0.4893 0.1112 0.1839 0.9027 0.3377 0.7803 0.2400 0.9448 0.9001 0.3897 0.4173 0.4909 0.3692 0.2417 [1:12](2) [1:12](2) | {Error: Unbalanced or unexpected parenthesis or bracket. } 1:12(2) 1:12(2) | {Error: Unbalanced or unexpected parenthesis or bracket. } (1:12)(2) (1:12)(2) | {Error: Unbalanced or unexpected parenthesis or bracket. } rand(3)(2) {Error: ()-indexing must appear last in an index expression. } rand(3)(2) {Error: ()-indexing must appear last in an index expression. } R=rand(3);R(2) ans = 0.0965 v=1:12; v(2) ans = 2 sin(cos(exp(4))) ans = -0.3622 M M = 0.1233 0.0497 0.4893 0.1112 0.1839 0.9027 0.3377 0.7803 0.2400 0.9448 0.9001 0.3897 0.4173 0.4909 0.3692 0.2417 M(15) ans = 0.3897 M > .6 ans = 0 0 0 0 0 1 0 1 0 1 1 0 0 0 0 0 where = M > .6 where = 0 0 0 0 0 1 0 1 0 1 1 0 0 0 0 0 whos('where') Name Size Bytes Class Attributes where 4x4 16 logical find(where==1) ans = 6 7 11 14 M M = 0.1233 0.0497 0.4893 0.1112 0.1839 0.9027 0.3377 0.7803 0.2400 0.9448 0.9001 0.3897 0.4173 0.4909 0.3692 0.2417 find(M==0.1233) ans = Empty matrix: 0-by-1 linspace( pi, 2*pi, 1 ) ans = 6.2832 linspace( pi, 2*pi, 2 ) ans = 3.1416 6.2832 linspace( pi, 2*pi, 3 ) ans = 3.1416 4.7124 6.2832 plot( linspace( pi, 2*pi, 10 ) ) pi, 2*pi ans = 3.1416 ans = 6.2832 plot( sin(linspace( pi, 2*pi, 10 )) ) plot( sin(linspace( pi, 2*pi, 100 )) ) plot( sin(linspace( pi, 6*pi, 100 )) ) plot( sin(linspace( pi, 6*pi, 2^7 )) ) plot( linspace( pi, 6*pi, 2^7 ), sin(linspace( pi, 6*pi, 2^7 )) ) M M = 0.1233 0.0497 0.4893 0.1112 0.1839 0.9027 0.3377 0.7803 0.2400 0.9448 0.9001 0.3897 0.4173 0.4909 0.3692 0.2417 diag(M,-1) ans = 0.1839 0.9448 0.3692 diag(diag(M,-1),2) ans = 0 0 0.1839 0 0 0 0 0 0.9448 0 0 0 0 0 0.3692 0 0 0 0 0 0 0 0 0 0 M M = 0.1233 0.0497 0.4893 0.1112 0.1839 0.9027 0.3377 0.7803 0.2400 0.9448 0.9001 0.3897 0.4173 0.4909 0.3692 0.2417 eig(M) ans = 1.9294 + 0.0000i -0.2449 + 0.0000i 0.2416 + 0.2855i 0.2416 - 0.2855i M = M + M' M = 0.2466 0.2336 0.7292 0.5285 0.2336 1.8054 1.2825 1.2711 0.7292 1.2825 1.8001 0.7590 0.5285 1.2711 0.7590 0.4834 eig(M) ans = -0.5050 0.1537 0.7723 3.9146 [W,V]=eig(M) W = 0.5333 0.7147 0.3949 -0.2211 0.4324 -0.1864 -0.6056 -0.6416 -0.1770 -0.4159 0.6495 -0.6115 -0.7052 0.5305 -0.2357 -0.4070 V = -0.5050 0 0 0 0 0.1537 0 0 0 0 0.7723 0 0 0 0 3.9146 W = eig(M) W = -0.5050 0.1537 0.7723 3.9146 help lu lu lu factorization. [L,U] = lu(A) stores an upper triangular matrix in U and a "psychologically lower triangular matrix" (i.e. a product of lower triangular and permutation matrices) in L, so that A = L*U. A can be rectangular. [L,U,P] = lu(A) returns unit lower triangular matrix L, upper triangular matrix U, and permutation matrix P so that P*A = L*U. [L,U,p] = lu(A,'vector') returns the permutation information as a vector instead of a matrix. That is, p is a row vector such that A(p,:) = L*U. Similarly, [L,U,P] = lu(A,'matrix') returns a permutation matrix P. This is the default behavior. Y = lu(A) returns the output from LAPACK'S DGETRF or ZGETRF routine if A is full. If A is sparse, Y contains the strict lower triangle of L embedded in the same matrix as the upper triangle of U. In both full and sparse cases, the permutation information is lost. [L,U,P,Q] = lu(A) returns unit lower triangular matrix L, upper triangular matrix U, a permutation matrix P and a column reordering matrix Q so that P*A*Q = L*U for sparse non-empty A. This uses UMFPACK and is significantly more time and memory efficient than the other syntaxes, even when used with COLAMD. [L,U,p,q] = lu(A,'vector') returns two row vectors p and q so that A(p,q) = L*U. Using 'matrix' in place of 'vector' returns permutation matrices. [L,U,P,Q,R] = lu(A) returns unit lower triangular matrix L, upper triangular matrix U, permutation matrices P and Q, and a diagonal scaling matrix R so that P*(R\A)*Q = L*U for sparse non-empty A. This uses UMFPACK as well. Typically, but not always, the row-scaling leads to a sparser and more stable factorization. Note that this factorization is the same as that used by sparse MLDIVIDE when UMFPACK is used. [L,U,p,q,R] = lu(A,'vector') returns the permutation information in two row vectors p and q such that R(:,p)\A(:,q) = L*U. Using 'matrix' in place of 'vector' returns permutation matrices. [L,U,P] = lu(A,THRESH) controls pivoting in sparse matrices, where THRESH is a pivot threshold in [0,1]. Pivoting occurs when the diagonal entry in a column has magnitude less than THRESH times the magnitude of any sub-diagonal entry in that column. THRESH = 0 forces diagonal pivoting. THRESH = 1 is the default. [L,U,P,Q,R] = lu(A,THRESH) controls pivoting in UMFPACK. THRESH is a one or two element vector which defaults to [0.1 0.001]. If UMFPACK selects its unsymmetric pivoting strategy, THRESH(2) is not used. It uses its symmetric pivoting strategy if A is square with a mostly symmetric nonzero structure and a mostly nonzero diagonal. For its unsymmetric strategy, the sparsest row i which satisfies the criterion A(i,j) >= THRESH(1) * max(abs(A(j:m,j))) is selected. A value of 1.0 results in conventional partial pivoting. Entries in L have absolute value of 1/THRESH(1) or less. For its symmetric strategy, the diagonal is selected using the same test but with THRESH(2) instead. If the diagonal entry fails this test, a pivot entry below the diagonal is selected, using THRESH(1). In this case, L has entries with absolute value 1/min(THRESH) or less. Smaller values of THRESH(1) and THRESH(2) tend to lead to sparser lu factors, but the solution can become inaccurate. Larger values can lead to a more accurate solution (but not always), and usually an increase in the total work and memory usage. [L,U,p] = lu(A,THRESH,'vector') and [L,U,p,q,R] = lu(A,THRESH,'vector') are also valid for sparse matrices and return permutation vectors. Using 'matrix' in place of 'vector' returns permutation matrices. See also chol, ilu, qr. Reference page in Help browser doc lu W = eig(M) W = -0.5050 0.1537 0.7723 3.9146 [W,V]=eig(M) W = 0.5333 0.7147 0.3949 -0.2211 0.4324 -0.1864 -0.6056 -0.6416 -0.1770 -0.4159 0.6495 -0.6115 -0.7052 0.5305 -0.2357 -0.4070 V = -0.5050 0 0 0 0 0.1537 0 0 0 0 0.7723 0 0 0 0 3.9146 B B = 0.9106 0.1361 0.1450 0.5132 0.1818 0.8693 0.8530 0.4018 0.2638 0.5797 0.6221 0.0760 0.1455 0.5499 0.3510 0.2399 B=[1 2; 3 4] B = 1 2 3 4 C = rand(2,2); X = B\C X = -1.6270 0.0829 1.2241 -0.0200 B*X-C ans = 1.0e-15 * -0.1110 0 0 -0.0278 norm(B*X-C) ans = 1.1102e-16 n=100; B=rand(n)+n*eye(n);C=rand(n); X=B\C; norm(B*X-C) ans = 5.5504e-15 n=100; B=rand(n)+n*eye(n);C=rand(n); X=B\C; norm(B*X-C) ans = 6.0067e-15 n=100; B=rand(n)+n*eye(n);C=rand(n); X=B\C; norm(B*X-C) ans = 5.9428e-15 n=100; B=rand(n)+n*eye(n);C=rand(n); X=B\C; norm(B*X-C) ans = 6.1874e-15 n=1000; B=rand(n)+n*eye(n);C=rand(n); X=B\C; norm(B*X-C) ans = 5.3138e-14 n=1000; B=rand(n)+n*eye(n);C=rand(n); X=B\C; norm(B*X-C) ans = 5.0425e-14 n=1000; B=rand(n)+n*eye(n);C=rand(n); X=B\C; norm(B*X-C) ans = 5.0861e-14 n=5000; B=rand(n)+n*eye(n);C=rand(n); X=B\C; norm(B*X-C) ans = 3.9043e-13 B\C == C/B ans = Columns 1 through 12 n=5; B=rand(n)+n*eye(n);C=rand(n); X=B\C; norm(B*X-C) ans = 2.9722e-16 B\C == C/B ans = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 A = [1 2; 3 4]; B = [1 -1; 1 1]; A A = 1 2 3 4 B B = 1 -1 1 1 A*B ans = 3 1 7 1 A.*B ans = 1 -2 3 4 A A = 1 2 3 4 B B = 1 -1 1 1 B.*A ans = 1 -2 3 4 A A = 1 2 3 4 1/A {Error using / Matrix dimensions must agree. } eye(2)/A ans = -2.0000 1.0000 1.5000 -0.5000 eye(2)/A == inv(A) ans = 0 1 1 1 1./A ans = 1.0000 0.5000 0.3333 0.2500 diary