MATLAB Linear Algebra Functions

15
2 Linear Algebra MATLAB Linear Algebra Functions The MATLAB matfun directory contains linear algebra functions. For a complete list, brief descriptions, and links to reference pages, type: help matfun The following table lists the MATLAB linear algebra functions by category. Function Summary Category Function Description 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 Matrix analysis subspace Angle between two subspaces 2-2

description

MATLAB Linear Algebra Functions

Transcript of MATLAB Linear Algebra Functions

  • 2 Linear Algebra

    MATLAB Linear Algebra FunctionsThe MATLAB matfun directory contains linear algebra functions. For acomplete list, brief descriptions, and links to reference pages, type:

    help matfun

    The following table lists the MATLAB linear algebra functions by category.

    Function Summary

    Category Function Description

    norm Matrix or vector normnormest Estimate the matrix

    2-normrank Matrix rankdet Determinanttrace Sum of diagonal

    elementsnull Null spaceorth Orthogonalizationrref Reduced row echelon

    form

    Matrix analysis

    subspace Angle between twosubspaces

    2-2

  • MATLAB Linear Algebra Functions

    Function Summary (Continued)

    Category Function Description

    \ and / Linear equationsolution

    inv Matrix inversecond Condition number for

    inversioncondest 1-norm condition

    number estimatechol Cholesky factorizationichol Incomplete Cholesky

    factorizationlinsolve Solve a system of linear

    equationslu LU factorizationilu Incomplete LU

    factorizationqr Orthogonal-triangular

    decompositionlsqnonneg Nonnegative

    least-squarespinv Pseudoinverse

    Linear equations

    lscov Least squares withknown covariance

    2-3

  • 2 Linear Algebra

    Function Summary (Continued)

    Category Function Description

    eig Eigenvalues andeigenvectors

    svd Singular valuedecomposition

    eigs A few eigenvaluessvds A few singular valuespoly Characteristic

    polynomialpolyeig Polynomial eigenvalue

    problemcondeig Condition number for

    eigenvalueshess Hessenberg formqz QZ factorization

    Eigenvalues andsingular values

    schur Schur decompositionexpm Matrix exponentiallogm Matrix logarithmsqrtm Matrix square root

    Matrix functions

    funm Evaluate generalmatrix function

    2-4

  • Matrices in the MATLAB Environment

    Adding and Subtracting MatricesAddition and subtraction of matrices is defined just as it is for arrays, elementby element. Adding A to B and then subtracting A from the result recovers B:

    A = pascal(3);B = magic(3);X = A + B

    X =9 2 74 7 105 12 8

    Y = X - A

    Y =8 1 63 5 74 9 2

    Addition and subtraction require both matrices to have the same dimension, orone of them be a scalar. If the dimensions are incompatible, an error results:

    C = fix(10*rand(3,2))X = A + CError using plusMatrix dimensions must agree.w = v + s

    w =9 7 6

    Vector Products and TransposeA row vector and a column vector of the same length can be multiplied ineither order. The result is either a scalar, the inner product, or a matrix,the outer product :

    u = [3; 1; 4];v = [2 0 -1];x = v*u

    2-7

  • 2 Linear Algebra

    x =2

    X = u*v

    X =6 0 -32 0 -18 0 -4

    For real matrices, the transpose operation interchanges aij and aji. MATLABuses the apostrophe operator (') to perform a complex conjugate transpose,and uses the dot-apostrophe operator (.') to transpose without conjugation.For matrices containing all real elements, the two operators return the sameresult.

    The example matrix A is symmetric, so A' is equal to A. But B is not symmetric:

    B = magic(3);X = B'

    X =8 3 41 5 96 7 2

    Transposition turns a row vector into a column vector:

    x = v'

    x =20

    -1

    If x and y are both real column vectors, the product x*y is not defined, butthe two products

    x'*y

    2-8

  • Matrices in the MATLAB Environment

    and

    y'*x

    are the same scalar. This quantity is used so frequently, it has three differentnames: inner product, scalar product, or dot product.

    For a complex vector or matrix, z, the quantity z' not only transposes thevector or matrix, but also converts each complex element to its complexconjugate. That is, the sign of the imaginary part of each complex elementchanges. So if

    z = [1+2i 7-3i 3+4i; 6-2i 9i 4+7i]z =

    1.0000 + 2.0000i 7.0000 - 3.0000i 3.0000 + 4.0000i6.0000 - 2.0000i 0 + 9.0000i 4.0000 + 7.0000i

    then

    z'ans =

    1.0000 - 2.0000i 6.0000 + 2.0000i7.0000 + 3.0000i 0 - 9.0000i3.0000 - 4.0000i 4.0000 - 7.0000i

    The unconjugated complex transpose, where the complex part of each elementretains its sign, is denoted by z.':

    z.'ans =

    1.0000 + 2.0000i 6.0000 - 2.0000i7.0000 - 3.0000i 0 + 9.0000i3.0000 + 4.0000i 4.0000 + 7.0000i

    For complex vectors, the two scalar products x'*y and y'*x are complexconjugates of each other, and the scalar product x'*x of a complex vectorwith itself is real.

    Multiplying MatricesMultiplication of matrices is defined in a way that reflects composition ofthe underlying linear transformations and allows compact representation of

    2-9

  • 2 Linear Algebra

    systems of simultaneous linear equations. The matrix product C = AB isdefined when the column dimension of A is equal to the row dimension of B,or when one of them is a scalar. If A is m-by-p and B is p-by-n, their productC is m-by-n. The product can actually be defined using MATLAB for loops,colon notation, and vector dot products:

    A = pascal(3);B = magic(3);m = 3; n = 3;for i = 1:m

    for j = 1:nC(i,j) = A(i,:)*B(:,j);

    endend

    MATLAB uses a single asterisk to denote matrix multiplication. The next twoexamples illustrate the fact that matrix multiplication is not commutative;AB is usually not equal to BA:

    X = A*B

    X =15 15 1526 38 2641 70 39

    Y = B*A

    Y =15 28 4715 34 6015 28 43

    A matrix can be multiplied on the right by a column vector and on the leftby a row vector:

    u = [3; 1; 4];x = A*u

    x =8

    2-10

  • Matrices in the MATLAB Environment

    1730

    v = [2 0 -1];y = v*B

    y =12 -7 10

    Rectangular matrix multiplications must satisfy the dimension compatibilityconditions:

    C = fix(10*rand(3,2));X = A*C

    X =17 1931 4151 70

    Y = C*A

    Error using mtimesInner matrix dimensions must agree.

    Anything can be multiplied by a scalar:

    s = 7;w = s*v

    w =14 0 -7

    Identity MatrixGenerally accepted mathematical notation uses the capital letter I to denoteidentity matrices, matrices of various sizes with ones on the main diagonaland zeros elsewhere. These matrices have the property that AI = A and IA = Awhenever the dimensions are compatible. The original version of MATLABcould not use I for this purpose because it did not distinguish between

    2-11

  • Systems of Linear Equations

    Systems of Linear Equations

    In this section...

    Computational Considerations on page 2-15The mldivide Algorithm on page 2-17General Solution on page 2-18Square Systems on page 2-18Overdetermined Systems on page 2-21Using Multithreaded Computation with Systems of Linear Equationson page 2-24Iterative Methods for Solving Systems of Linear Equations on page 2-25

    Computational ConsiderationsOne of the most important problems in technical computing is the solution ofsystems of simultaneous linear equations.

    In matrix notation, the general problem takes the following form: Given twomatrices A and B, does there exist a unique matrix X so that AX = B or XA = B?

    It is instructive to consider a 1-by-1 example. For example, does the equation

    7x = 21

    have a unique solution?

    The answer, of course, is yes. The equation has the unique solution x = 3. Thesolution is easily obtained by division:

    x = 21/7 = 3.

    The solution is not ordinarily obtained by computing the inverse of 7, that is71 = 0.142857..., and then multiplying 71 by 21. This would be more workand, if 71 is represented to a finite number of digits, less accurate. Similarconsiderations apply to sets of linear equations with more than one unknown;

    2-15

  • 2 Linear Algebra

    the MATLAB software solves such equations without computing the inverseof the matrix.

    Although it is not standard mathematical notation, MATLAB uses thedivision terminology familiar in the scalar case to describe the solution of ageneral system of simultaneous equations. The two division symbols, slash, /,and backslash, \, correspond to the two MATLAB functions mldivide andmrdivide. mldivide and mrdivide are used for the two situations where theunknown matrix appears on the left or right of the coefficient matrix:

    X = B/A Denotes the solution to the matrix equationXA = B.

    X = A\B Denotes the solution to the matrix equationAX = B.

    Think of dividing both sides of the equation AX = B or XA = B by A. Thecoefficient matrix A is always in the denominator.

    The dimension compatibility conditions for X = A\B require the two matricesA and B to have the same number of rows. The solution X then has thesame number of columns as B and its row dimension is equal to the columndimension of A. For X = B/A, the roles of rows and columns are interchanged.

    In practice, linear equations of the form AX = B occur more frequently thanthose of the form XA = B. Consequently, the backslash is used far morefrequently than the slash. The remainder of this section concentrates on thebackslash operator; the corresponding properties of the slash operator canbe inferred from the identity:

    (B/A)' = (A'\B')

    The coefficient matrix A need not be square. If A is m-by-n, there are threecases:

    2-16

  • Systems of Linear Equations

    m = n Square system. Seek an exact solution.m > n Overdetermined system. Find a least squares

    solution.m < n Underdetermined system. Find a basic solution

    with at most m nonzero components.

    The mldivide AlgorithmThe mldivide operator employs different algorithms to handle different kindsof coefficient matrices. The various cases are diagnosed automatically byexamining the coefficient matrix.

    Permutations of Triangular Matricesmldivide checks for triangularity by testing for zero elements. If a matrix Ais triangular, MATLAB software uses a substitution to compute the solutionvector x. If A is a permutation of a triangular matrix, MATLAB software usesa permuted substitution algorithm.

    Square MatricesIf A is symmetric and has real, positive diagonal elements, MATLAB attemptsa Cholesky factorization. If the Cholesky factorization fails, MATLABperforms a symmetric, indefinite factorization. If A is upper Hessenberg,MATLAB uses Gaussian elimination to reduce the system to a triangularmatrix. If A is square but is neither permuted triangular, symmetric andpositive definite, or Hessenberg, MATLAB performs a general triangularfactorization using LU factorization with partial pivoting (see lu).

    Rectangular MatricesIf A is rectangular, mldivide returns a least-squares solution. MATLABsolves overdetermined systems with QR factorization (see qr). For anunderdetermined system, MATLAB returns the solution with the maximumnumber of zero elements.

    The mldivide function reference page contains a more detailed descriptionof the algorithm.

    2-17

  • 2 Linear Algebra

    General SolutionThe general solution to a system of linear equations AX = b describes allpossible solutions. You can find the general solution by:

    1 Solving the corresponding homogeneous system AX = 0. Do this using thenull command, by typing null(A). This returns a basis for the solutionspace to AX = 0. Any solution is a linear combination of basis vectors.

    2 Finding a particular solution to the nonhomogeneous system AX = b.

    You can then write any solution to AX = b as the sum of the particularsolution to AX = b, from step 2, plus a linear combination of the basis vectorsfrom step 1.

    The rest of this section describes how to use MATLAB to find a particularsolution to AX = b, as in step 2.

    Square SystemsThe most common situation involves a square coefficient matrix A and a singleright-hand side column vector b.

    Nonsingular Coefficient MatrixIf the matrix A is nonsingular, the solution, x = A\b, is then the same size asb. For example:

    A = pascal(3);u = [3; 1; 4];x = A\u

    x =10

    -125

    It can be confirmed that A*x is exactly equal to u.

    If A and B are square and the same size, X = A\B is also that size:

    B = magic(3);

    2-18

  • Systems of Linear Equations

    X = A\B

    X =19 -3 -1

    -17 4 136 0 -6

    It can be confirmed that A*X is exactly equal to B.

    Both of these examples have exact, integer solutions. This is because thecoefficient matrix was chosen to be pascal(3), which has a determinantequal to 1.

    Singular Coefficient MatrixA square matrix A is singular if it does not have linearly independentcolumns. If A is singular, the solution to AX = B either does not exist, or is notunique. The backslash operator, A\B, issues a warning if A is nearly singularand raises an error condition if it detects exact singularity.

    If A is singular and AX = b has a solution, you can find a particular solutionthat is not unique, by typing

    P = pinv(A)*b

    P is a pseudoinverse of A. If AX = b does not have an exact solution, pinv(A)returns a least-squares solution.

    For example:

    A = [ 1 3 7-1 4 41 10 18 ]

    is singular, as you can verify by typing

    det(A)

    ans =0

    2-19

  • 2 Linear Algebra

    Note For information about using pinv to solve systems with rectangularcoefficient matrices, see Pseudoinverses on page 2-28.

    Exact Solutions. For b =[5;2;12], the equation AX = b has an exactsolution, given by

    pinv(A)*b

    ans =0.3850

    -0.11030.7066

    Verify that pinv(A)*b is an exact solution by typing

    A*pinv(A)*b

    ans =5.00002.0000

    12.0000

    Least-Squares Solutions. On the other hand, if b = [3;6;0], AX = b doesnot have an exact solution. In this case, pinv(A)*b returns a least squaressolution. If you type

    A*pinv(A)*b

    ans =-1.00004.00002.0000

    you do not get back the original vector b.

    You can determine whether AX = b has an exact solution by finding therow reduced echelon form of the augmented matrix [A b]. To do so for thisexample, enter

    2-20

  • Systems of Linear Equations

    rref([A b])ans =

    1.0000 0 2.2857 00 1.0000 1.5714 00 0 0 1.0000

    Since the bottom row contains all zeros except for the last entry, the equationdoes not have a solution. In this case, pinv(A) returns a least-squaressolution.

    Overdetermined SystemsOverdetermined systems of simultaneous linear equations are oftenencountered in various kinds of curve fitting to experimental data. Here is ahypothetical example. A quantity y is measured at several different valuesof time, t, to produce the following observations:

    t y

    0.0 0.820.3 0.720.8 0.631.1 0.601.6 0.552.3 0.50

    Enter the data into MATLAB with the statements

    t = [0 .3 .8 1.1 1.6 2.3]';y = [.82 .72 .63 .60 .55 .50]';

    Try modeling the data with a decaying exponential function:

    y(t) = c1 + c2et.

    The preceding equation says that the vector y should be approximated by alinear combination of two other vectors, one the constant vector containing allones and the other the vector with components et. The unknown coefficients,

    2-21

    tocMatrices and ArraysCreating and Concatenating MatricesOverviewConstructing a Simple MatrixEntering Signed Numbers

    Specialized Matrix FunctionsExamples

    Concatenating MatricesKeeping Matrices Rectangular

    Matrix Concatenation FunctionsExamples

    Generating a Numeric SequenceThe Colon OperatorUsing the Colon Operator with a Step Value

    matccreatMatrix IndexingAccessing Single ElementsLinear IndexingFunctions That Control Indexing StyleAccessing Multiple ElementsNonconsecutive ElementsThe end KeywordSpecifying All Elements of a Row or Column

    Using Logicals in Array IndexingLogical Indexing Example 1Logical Indexing Example 2Logical Indexing with a Smaller Array

    Single-Colon Indexing with Different Array TypesIndexing on Assignment

    Getting Information About a MatrixDimensions of the MatrixExample Using numelExample Using ndims, numel, and size

    Classes Used in the MatrixExample Using isnumeric and isreal

    Data Structures Used in the Matrix

    Resizing and Reshaping MatricesExpanding the Size of a MatrixConcatenating Onto the MatrixAdding Smaller Blocks to a Matrix

    Diminishing the Size of a MatrixReshaping a MatrixExamples

    Preallocating MemoryBuilding a Preallocated Array

    Shifting and Sorting MatricesShift and Sort FunctionsShifting the Location of Matrix ElementsSorting the Data in Each ColumnSorting the Data in Each RowSorting Row Vectors

    Operating on Diagonal MatricesDiagonal Matrix FunctionsConstructing a Matrix from a Diagonal VectorReturning a Triangular Portion of a MatrixConcatenating Matrices Diagonally

    Empty Matrices, Scalars, and VectorsOverviewThe Empty MatrixOperating on an Empty MatrixUsing Empty Matrices in Relational OperationsUsing Empty Matrices in Logical Operations

    ScalarsVectors

    Full and Sparse MatricesOverviewSparse Matrix Functions

    Multidimensional ArraysOverviewCreating Multidimensional ArraysGenerating Arrays Using IndexingExtending Multidimensional ArraysGenerating Arrays Using MATLAB FunctionsBuilding Multidimensional Arrays with the cat Function

    Accessing Multidimensional Array PropertiesIndexing Multidimensional ArraysThe Colon and Multidimensional Array IndexingLinear Indexing with Multidimensional ArraysAvoiding Ambiguity in Multidimensional Indexing

    Reshaping Multidimensional ArraysRemoving Singleton Dimensions

    Permuting Array DimensionsInverse Permutation

    Computing with Multidimensional ArraysOperating on VectorsOperating Element-by-ElementOperating on Planes and Matrices

    Organizing Data in Multidimensional ArraysMultidimensional Cell ArraysMultidimensional Structure ArraysApplying Functions to Multidimensional Structure Arrays

    Summary of Matrix and Array Functions

    Linear AlgebraMATLAB Linear Algebra FunctionsMatrices in the MATLAB EnvironmentCreating MatricesAdding and Subtracting MatricesVector Products and TransposeMultiplying MatricesIdentity MatrixKronecker Tensor ProductVector and Matrix NormsUsing Multithreaded Computation with Linear Algebra Functions

    Systems of Linear EquationsComputational ConsiderationsThe mldivide AlgorithmPermutations of Triangular MatricesSquare MatricesRectangular Matrices

    General SolutionSquare SystemsNonsingular Coefficient MatrixSingular Coefficient Matrix

    Overdetermined SystemsUsing Multithreaded Computation with Systems of Linear EquationsIterative Methods for Solving Systems of Linear Equations

    Inverses and DeterminantsIntroductionPseudoinversesSolving a Rank-Deficient System

    FactorizationsIntroductionCholesky FactorizationLU FactorizationQR FactorizationUsing Multithreaded Computation for Factorization

    Powers and ExponentialsPositive Integer PowersInverse and Fractional PowersElement-by-Element PowersExponentials

    EigenvaluesEigenvalue DecompositionMultiple EigenvaluesSchur Decomposition

    Singular Values

    Random NumbersGenerating Random NumbersControlling Random Number Generation"Starting Over"Non-RepeatabilityMore Control over Repeatability and Non-RepeatabilityChoosing a Generator TypeSaving and Restoring Random Number Generator SettingsWriting Simpler, More Flexible, CodeLegacy Mode and rngrng and RandStreamManaging the Global StreamRandom Number Data Types

    Creating and Controlling a Random Number StreamSubstreamsChoosing a Random Number GeneratorGenerator AlgorithmsTransformation Algorithms

    Compatibility Considerations

    Multiple streamsUpdating Your Random Number Generator SyntaxDescription of the Former SyntaxesInitializing the Generator with an Integer SeedInitializing the Generator with a State VectorIf You Are Unable to Upgrade from Former Syntax

    Selected Bibliography

    Sparse MatricesFunction SummaryFunctions That Support Sparse MatricesElementary Sparse MatricesFull to Sparse ConversionWorking with Sparse MatricesGraph TheoryReordering AlgorithmsLinear AlgebraLinear Equations (Iterative Methods)Other Miscellaneous Functions

    Functions That Do Not Support Sparse MatricesElementary Matrices and ArraysElementary Math FunctionsBit-Wise FunctionsEigenvalue and Singular Value FunctionsMatrix Analysis FunctionsFactorization FunctionsLinear Equation FunctionsSpecial FunctionsFiltering and Convolution FunctionsFourier Transform FunctionsHistogram Plotting Functions

    Functions with Sparse Alternatives

    Computational AdvantagesMemory ManagementComputational Efficiency

    Constructing Sparse MatricesCreating Sparse MatricesConverting Full to SparseCreating Sparse Matrices DirectlyCreating Sparse Matrices from Their Diagonal Elements

    Importing Sparse Matrices

    Accessing Sparse MatricesNonzero ElementsIndices and ValuesIndexing in Sparse Matrix OperationsVisualizing Sparse Matrices

    Sparse Matrix OperationsEfficiency of OperationsComputational ComplexityAlgorithmic Details

    Permutations and ReorderingReordering for SparsityReordering to Reduce BandwidthApproximate Minimum Degree Ordering

    Factoring Sparse MatricesLU FactorizationCholesky FactorizationQR FactorizationIncomplete Factorizations

    Systems of Linear EquationsDirect MethodsIterative Methods

    Eigenvalues and Singular ValuesPerformance LimitationsCreating Sparse MatricesManipulating Sparse Matrices

    Selected Bibliography

    Functions of One VariableFunction SummaryRepresenting PolynomialsEvaluating PolynomialsRoots of PolynomialsRoots of Scalar FunctionsSolving a Nonlinear Equation in One VariableSetting Options For fzero

    Using a Starting IntervalUsing a Starting Point

    DerivativesConvolutionPartial Fraction ExpansionsPolynomial Curve FittingCharacteristic Polynomials

    Computational GeometryOverviewTriangulation Representations2-D and 3-D DomainsTriangulation Face-Vertex FormatQuerying Triangulations Using TriRepThe TriRep Class

    Delaunay TriangulationDefinition of Delaunay TriangulationCreating Delaunay TriangulationsDelaunay Triangulation Using delaunay and delaunaynDelaunay Triangulation Using the DelaunayTri ClassConstrained Delaunay Triangulation

    Triangulation of Point Sets Containing Duplicate Locations

    Spatial SearchingIntroductionNearest-Neighbor SearchPoint LocationSearching Non-Delaunay Triangulations

    Voronoi DiagramsComputing the Voronoi Diagram

    Convex HullsComputing the Convex HullComputing the Convex Hull Using convhull and convhullnConvex Hull Computation Using the DelaunayTri Class

    InterpolationInterpolating Gridded DataGridded Data Representation Grid RepresentationTypes of Grid RepresentationsGrid Approximation Techniques

    Grid-Based InterpolationBenefits of Using Grid-Based InterpolationInterpolation versus FitInterpolation Methods

    Interpolation with the interp Family of FunctionsThe interp1 Function1-D Extrapolation With interp1The interp2 and interp3 FunctionsThe interpn Function

    Interpolation with the griddedInterpolant ClassConstructing the InterpolantQuerying the InterpolantConverting meshgrid Data to the ndgrid FormatgriddedInterpolant in 1 DimensiongriddedInterpolant in Two DimensionsgriddedInterpolant in Three DimensionsgriddedInterpolant in Four DimensionsOther Ways of Working with griddedInterpolant

    Interpolating Scattered DataScattered DataInterpolating Scattered Data Using griddata and griddatanInterpolating Scattered Data Using the TriScatteredInterp ClassInterpolation of Complex Scattered DataAddressing Problems in Scattered Data InterpolationInput Data Containing NaNsInterpolant Outputs NaN ValuesHandling of Duplicate Point LocationsAchieving Efficiency When Editing a TriScatteredInterpInterpolation Results Poor Near the Convex Hull

    OptimizationFunction SummaryOptimizing Nonlinear FunctionsMinimizing Functions of One VariableMinimizing Functions of Several Variablesfminsearch AlgorithmMaximizing Functions

    Example: Curve Fitting via OptimizationCurve Fitting by OptimizationCreating an Example FileRunning the ExamplePlotting the Results

    Setting OptionsIterative DisplayOutput FunctionsWhat Is an Output Function?Creating and Using an Output FunctionStructure of the Output FunctionExample of a Nested Output FunctionFields in optimValuesStates of the AlgorithmStop FlagStopping an Optimization Based on Data in optimValuesStopping an Optimization Based on GUI Input

    Plot FunctionsWhat Is A Plot Function?Example: Plot Function

    Troubleshooting and TipsReference

    Function HandlesIntroductionDefining Functions In FilesAnonymous FunctionsExample: Function Plotting FunctionParameterizing FunctionsUsing Nested FunctionsUsing Anonymous Functions

    CalculusOrdinary Differential EquationsFunction SummaryODE SolversEvaluation and ExtensionSolver OptionsOutput Functions

    Initial Value ProblemsFirst Order ODEsHigher Order ODEsInitial Values

    Types of SolversNonstiff ProblemsStiff ProblemsFully Implicit ODEs

    Solver SyntaxIntegrator OptionsExamplesvan der Pol Equation (Nonstiff)van der Pol Equation (Stiff)van der Pol Equation (Parameterizing the ODE)van der Pol Equation (Evaluating the Solution)Euler Equations (Nonstiff)Fully Implicit ODEFinite Element DiscretizationLarge Stiff Sparse ProblemEvent LocationAdvanced Event LocationDifferential-Algebraic EquationsNonnegative SolutionsAdditional Examples

    Troubleshooting

    Delay Differential EquationsFunction SummaryDDE SolversDDE Helper FunctionsDDE Solver Options

    Initial Value ProblemsHistory and Initial ValuesPropagation of Discontinuities

    Types of SolversDDE Solver dde23DDE Solver ddesd

    DiscontinuitiesIntegrator OptionsExamplesConstant DelayState-Dependent DelayCardiovascular ModelAdditional Examples

    Boundary-Value ProblemsFunction SummaryBVP SolverBVP Helper FunctionsBVP Solver Options

    Boundary Value ProblemsBoundary Conditions

    BVP SolverThe BVP SolverBVP Solver SyntaxBVP Solver Options

    Integrator OptionsExamplesMathieu's EquationContinuationSingular BVPsMultipoint BVPsAdditional Examples

    Partial Differential EquationsFunction SummaryPDE SolverPDE Helper Function

    Initial Value ProblemsPDE SolverThe PDE SolverPDE Solver SyntaxPDE Solver Options

    Integrator OptionsExamplesSingle PDESystem of PDEsAdditional Examples

    Selected Bibliography for Differential EquationsIntegrationQuadrature FunctionsExample: Arc LengthExample: Double Integration

    Fourier TransformsDiscrete Fourier Transform (DFT)IntroductionVisualizing the DFT

    Fast Fourier Transform (FFT)IntroductionThe FFT in One DimensionIntroductionExample: Basic Spectral AnalysisExample: Spectral Analysis of a Whale CallExample: Data Interpolation

    The FFT in Multiple DimensionsIntroductionExample: Diffraction Patterns

    Function Summary

    Index

    tablesFunctions to Create a MatrixFunctions to Modify the Shape of a MatrixFunctions to Find the Structure or Shape of a MatrixFunctions to Determine ClassFunctions to Sort and Shift Matrix ElementsFunctions That Work on Diagonals of a MatrixFunctions to Change the Indexing StyleFunctions for Working with Multidimensional ArraysFunction SummaryGenerator algorithmsFunctions for Iterative Methods for Sparse SystemsFunctions to Compute a Few Eigenvalues or Singular ValuesGeneral QuestionsMemory and Computational EfficiencyTime Steps for IntegrationError Tolerance and Other OptionsOther Types of EquationsOther Common ProblemsPDE Properties