MATLAB Release Notes

Mathematics Features

The following mathematics features have been added or enhanced in MATLAB 6.0:

These features are described below. At the end of this section are tables that summarize changes to the MATLAB math functions:

Matrix Math in MATLAB 6.0

Matrix computations in MATLAB 6.0 are based on LAPACK, a large, multiauthor Fortran subroutine library for numerical linear algebra. LAPACK extends the MATLAB matrix computation capabilities and increases its speed on larger problems. It offers MATLAB a larger class of algorithms from which to choose based on the properties of the matrix arguments. Optimized Basic Linear Algebra Subroutines (BLAS), on all MATLAB platforms, speeds up matrix multiplication and the LAPACK routines themselves. Optimized BLAS is provided by Automatically Tuned Linear Algebra Software (ATLAS).

The LAPACK Users' Guide, Third Edition, is available online at http://www.netlib.org/lapack/lug/lapack_lug.html.

Differing Results.   Matrix functions in earlier versions of MATLAB continue to operate in the same way in MATLAB 6.0, but the results they return may differ. Changes in roundoff errors can be seen in most matrix computations. In cases where quantities are not uniquely determined mathematically, results may differ in order and in normalization.

For example:

• Eigenvalues may be returned in a different order.
• Eigenvectors may be normalized differently.
• The signs of columns of orthogonal matrices may differ.
• `rcond` is a better estimate of the reciprocal condition.
• `lu` can now be used to factor rectangular full matrices.

Increased Number of Eigenvalue Algorithms.   With MATLAB 6.0, there are now eight different eigenvalue algorithms, determined by

• `eig(A)` or `eig(A,B)`
• Real or complex matrices
• Symmetric/Hermitian matrices and `B`, if any, positive definite
• Whether eigenvectors are requested or not

For the symmetric and Hermitian problems, the eigenvalues are real, sorted in increasing order and the eigenvectors are normalized so that

• ```V'*V or V'*B*V = I
```

New Decompositions for Real Matrices.   The QZ algorithm returns a newly available real decomposition for real matrices. If `A` and `B` are real and not symmetric,

• ```[AA,BB,...] = qz(A,B,'real')
```

returns a real triangular matrix `BB` and a real quasitriangular matrix `AA` with 2-by-2 diagonal blocks corresponding to pairs of complex conjugate eigenvalues. Earlier versions of MATLAB produced complex triangular `AA` and `BB` if there were any complex eigenvalues. You can continue to obtain this behavior with either

• ```[AA,BB,...] = qz(A,B)
```

or

• ```[AA,BB,...] = qz(A,B,'complex')
```

A similar option for the Schur decomposition of a real matrix

• ```T = schur(A,'complex')
```

produces a complex decomposition if `A` has any complex eigenvalues.

The flops Function.   The incorporation of LAPACK makes it impractical to count floating-point operations. As a result, the `flops` function is inoperative in MATLAB 6.0. It will be discontinued completely in some future version.

With modern computer architectures, floating-point operation counts are no longer a good predictor of execution time. Counts of memory references and cache usage patterns have become more important.

N-Dimensional Delaunay-Type Functionality

New Qhull-based functions extend Delaunay-type functionality:

• `delaunayn` and `delaunay3` for N-dimensional Delaunay tessellation
• `convhulln` N-dimensional convex hull
• `voronoin` for N-dimensional Voronoi diagrams
• `griddatan` and `griddata3` for data gridding and hyper-surface fitting

Differential Equation Solvers

New differential equation solvers expand the capabilties of MATLAB:

• `bvp4c` solves two-point boundary value problems for ODEs by collocation. Supporting functions enable you to set options that affect problem solution, form an initial guess, and evaluate the numerical solution obtained with `bvp4c`.
• `pdepe` solves initial-boundary value problems for parabolic-elliptic PDEs in 1-D. A supporting function enables you to evaluate the numerical solution obtained with `pdepe`.

The ODE solvers now take advantage of function handles and can solve problems without using ODE files. The new syntax is

• ````solver`(@odefun,tspan,y0,options,p1,p2,...)
```

where @`odefun`, `tspan` and `y0` are required arguments. See the ODE solver and `odeset` reference pages for details.

MATLAB 6.0 supports use of an ODE file for backwards compatibility, but new functionality is available only with the new syntax.

Sparse Matrix Computations

New and upgraded routines provide new capabilities and speed up computations:

• `eigs` and `svds` now use the Fortran library ARPACK.
• New routines, `symmlq`, `minres` and `lsqr`, iteratively solve symmetric indefinite systems and least squares problems.
• New routines, `colamd` and `symamd`, provide approximate minimum degree permutations to help reduce the fill-in of their sparse factors.
• `condest` can now produce more accurate condition estimates.

Fast Fourier Transforms

Fast Fourier transform (FFT) functions now rely on the MIT FFTW library. This results in faster performance for composite, prime, and large prime factor array lengths.

New quadrature algorithms in `quad` and the new function `quadl` are faster, more accurate and more robust in that they handle singularities better. `quadl` replaces the now obsolete `quad8` function.

Interpolation

A new one-dimensional interpolation function, `pchip`, based on piecewise cubic Hermite interpolating polynomials, preserves the shape and monotonicity of the underlying data.

Function Functions

All function functions are now capable of accepting function handles as arguments. Most also accept additional parameters, which they pass to the function that you pass in as an argument.

For information about function handles, see the `function_handle` (`@`), `func2str`, and `str2func` reference pages, and the Function Handles section of "Programming and Data Types" in the MATLAB documentation.

The Basic Fitting Interface

MATLAB supports curve fitting through the Basic Fitting interface. Using this interface, you can quickly perform many curve fitting tasks within the same easy-to-use environment. The interface is designed so that you can

• Fit data using a spline interpolant, a hermite interpolant, or a polynomial up to degree 10.
• Plot multiple fits simultaneously for a given data set.
• Plot the fit residuals.
• Examine the numerical results of a fit.
• Evaluate (interpolate or extrapolate) a fit.
• Annotate the plot with the numerical fit results and the norm of residuals.
• Save the fit and evaluated results to the MATLAB workspace.

Depending on your specific curve fitting application, you can use the Basic Fitting interface, the command line functionality such as `polyfit` and `polyval`, or both.

The Data Statistics Interface

MATLAB has a new visual interface that:

• Calculates basic statistics about the central tendency and variability of data plotted in a graph
• Lets you save the statistics to the workspace
• Lets you plot any of the statistics in a graph

When you select Data Statistics from the MATLAB figure window Tools menu, MATLAB calculates the statistics for each data set plotted in the graph and displays the results in a Data Statistics dialog box. To plot a statistic in a graph, click in the check box next to its value. To save a set of statistics as a workspace variable, click on the Save to workspace... button. The Data Statistics tool saves the statistics as a structure. The following figure shows the components of this dialog box.

Math Function Summary Tables

This section summarizes

For more information on these functions, see their respective reference pages or type

• ```help function
```

in the MATLAB command window, where `function` is the name of the function about which you want to obtain more information.

 Note    See Upgrading from an Earlier Release for information about obsolete functions.

 Function Purpose `bvp4c` Solve two-point boundary value problems (BVPs) for ODEs by collocation `bvpget` Extract an option from the BVP options structure `bvpinit` Form the initial guess for `bvp4c` `bvpset` Create/alter BVP options structure `bvpval` Evaluate the solution computed by `bvp4c` `colamd` Column approximate minimum degree permutation `convhulln` N-dimensional convex hull `delaunay3` Three-dimensional Delaunay tessellation `delaunayn` N-dimensional Delaunay tessellation `dsearchn` N-dimensional nearest point search `griddata3` Data gridding and hyper-surface fitting for 3-D data `griddatan` Data gridding and hyper-surface fitting (dimension >= 2) `lsqr` LSQR implementation of Conjugate Gradients on the Normal Equations `minres` Solve a system of equations using Minimum Residual Method `pchip` Piecewise Cubic Hermite Interpolating Polynomial (PCHIP) - preserves monotonicity and the shape of the data. `pchip` is used by `interp1(x,y,xi,'cubic')` `pdepe` Solve initial-boundary value problems for parabolic-elliptic partial differential equations (PDEs) in one dimension `pdeval` Evaluate by interpolation the solution computed by `pdepe` `quadl` Numerically evaluate an integral using adaptive Lobatto quadrature `symamd` Symmetric approximate minimum degree permutation `symmlq` Solve a system of equations using symmetric LQ method `voronoin` Compute N-dimensional Voronoi diagram

 Function Purpose `condest` `[c,v] = condest(A,t)` specifies a new argument, `t,` a positive integer equal to the number of columns in an underlying iteration matrix. Increasing the number of columns usually gives a better condition estimate but increases the cost. The default is `t = 2`, which almost always gives an estimate correct to within a factor 2. `dblquad` `dblquad` now accepts extra arguments `p1,p2,...` which it passes to `fun`. For example,```dblquad(fun,xmin,xmax,ymin,ymax,tol,...         @quadl,p1,p2,...) ``` `eig` For symmetric `A` and symmetric positive definite `B, eig(A,B,'chol')` computes the generalized eigenvalues of `A` and `B` using the Cholesky factorization of `B`. `'chol'` is the default.`eig(A,B,'qz')` ignores the symmetry, if any, and uses the QZ algorithm. `eigs` Now provides an interface to a subset of the ARPACK capabilities. See the `eigs` reference page for information about the expanded syntax, and the `sigma` and `options` arguments. The MATLAB 5 arbitrary ordering of the inputs `B`, `k`, `sigma,` and `options` is no longer allowed. `fftshift, ifftshift` `fftshift(X,dim)` and `ifftshift(X,dim)` can now apply the shift operation along the dimension specified by `dim`. `fminbnd, fminsearch, fzero, lsqnonneg` A new `Display` options parameter value, `'notify'`, displays output only if the function does not converge. For these functions, `'notify'` is the default. `fzero` MATLAB Version 5 changed the calling sequence for `fzero`. See the instructions for converting your code in "Function Functions" in the MATLAB documentation. `gallery` Two new options produce these test matrices: `'randcolu'` - Random matrix with normalized columns and specified singular values`'randcorr'` - Random correlation matrix with specified eigenvalues `interp1` `interp1(x,y,xi,'cubic')` and `interp1(x,y,xi,'pchip')` use `pchip` to perform the interpolation. A new flag `'v5cubic'` provides the cubic interpolation used in MATLAB 5. The default method is `'linear'`. `interp1(x,y,xi,method,'extrap')` uses the specified method to extrapolate any element of `xi` that is outside the interval spanned by `x`.`interp1(x,y,xi,method,extrapval)` returns the scalar `extrapval` for out of range values. `lu` `lu(X)` can now be used to factor rectangular matrices. `ode45, ode23, ode113, ode15s, ode23s, ode23t, ode23tb` The ODE solvers can now solve problems without the use of an ODE file. Problem components are passed to the solvers directly as arguments, or provided using parameters in an options structure. See the ODE solvers and `odeset` reference pages for details.MATLAB 6.0 supports use of an ODE file for backwards compatibility, but new functionality is available only in the new syntax. `polyval, polyfit` An optional output argument for `polyfit` and an optional input argument to `polyval` provide for centering and scaling, that is, subtracting the mean and normalizing the standard deviation of the independent variable. `quad` `quad(fun,a,b)` uses a new default tolerance, 10-6.Because of the use of new quadrature algorithms, your results (`q`) and the number of function evaluations (`trace(1) = fcnt`) may differ from MATLAB 5. The new algorithm provides more accurate results and generally result in improved performance. `qz` For real `A` and `B`, `[AA,BB,Q,Z,V] = qz(A,B,'real')` produces a real decomposition with a quasitriangular `AA`.`[AA,BB,Q,Z,V] = qz(A,B,'complex')` produces a possibly complex decomposition with a triangular `AA`. `schur` For real `X`, `schur(X,'real')` has the real eigenvalues on the diagonal and the complex eigenvalues in 2-by-2 blocks on the diagonal. `schur(X,'complex')` is triangular and is complex if `X` has complex eigenvalues. `sort` `sort(S)` now works on other data types, for example `int32`, and has been rewritten to be faster on doubles. `sort(S,dim)` can now sort the elements of both full and sparse matrices along the dimension specified by `dim`. `sqrtm` `[X, alpha, condest] = sqrtm(A) `returns a stability factor `alpha` and an estimate `condest` of the matrix square root condition number of `X`. `std` `std([])` no longer returns empty. It now returns `NaN`, and a message, `Warning:` `Divide by zero`.

 Development Environment Features Programming and Data Types Features