Mathematics, MATLAB Version 7 (R14)

This version introduces the following new features and changes:

New and Obsolete Functions

Nondouble Math

Matrices and Elementary Math

Linear Algebra

Nonlinear Methods

Trigonometry, Geometry

Differential Equations

FFT

Optimization

Specialized Math

Other

New Functions

This release introduces the following new functions:

Function

Description

accumarray

Construct array with accumulation

cast

Cast variable to different type

expm1

Compute exp(x)-1 accurately for small values of x

intmax

Largest value of specified integer type

intmin

Smallest value of specified integer type

intwarning

Control state of integer warnings

isfloat

Determine whether input is floating-point array

isinteger

Determine whether input is integer array

linsolve

Solve linear system of equations

log1p

Compute log(1+x) accurately for small values of x

nthroot

Real nth root of real numbers

ode15i

Solve fully implicit differential equations, variable order method

odextend

Extend solution of initial value problem for ordinary differential equation

quadv

Vectorized quadrature

Obsolete Functions

The functions listed in the left column of the following table are obsolete and will be removed from a future version of MATLAB.

Compatibility Considerations

Use the replacement functions listed in the right column instead.

Obsolete Function

Replacement Function

colmmd

colamd

quad8

quadl

symmmd

symamd

The following obsolete functions are no longer included in MATLAB:

fmin, fmins, icubic, interp4, interp5, interp6, meshdom, nnls, 
saxis

New Nondouble Mathematics Features

MATLAB Version 7.0 supports many arithmetic operations and mathematical functions on the following nondouble MATLAB data types:

Most of the built-in MATLAB functions that perform mathematical operations now support inputs of type single. In addition, the arithmetic operators and the functions sum, diff, colon, and some elementary functions now support integer data types.

Nondouble Arithmetic

This section describes how MATLAB performs arithmetic on nondouble data types.

Single Arithmetic

You can now combine numbers of type single with numbers of type double or single. MATLAB performs arithmetic as if both inputs had type single and returns a result of type single. For more information, see Single-Precision Floating Point in the online MATLAB Programming documentation.

Integer Arithmetic

You can now combine numbers of an integer data type with numbers of the same integer data type or type scalar double. MATLAB performs arithmetic as if both inputs had type double and then converts the result to the same integer data type.

MATLAB computes operations on arrays of integer data type using saturating integer arithmetic. Saturating means that if the result is greater than the upper bound of the integer data type, MATLAB returns the upper bound. Similarly, if the result is less than the lower bound of the data type, MATLAB returns the lower bound. For more information, see Integers in the online MATLAB Programming documentation.

New Integer Functions — intmax and intmin

Two new functions, intmax and intmin, return the largest and smallest numbers, respectively, for integer data types. For example,

intmax('int8')
ans =
   127

returns the largest number of type int8. See Largest and Smallest Values for Integer Classes in the online MATLAB documentation for more information.

New Warnings for Integer Arithmetic

This section describes four new warning messages for integer arithmetic in Version 7.0. While these warnings are turned off by default, you can turn them on as a diagnostic tool or to warn of behavior in integer arithmetic that might not be expected.

To turn all four warning messages on at once, enter

intwarning on

Integer Conversion of Noninteger Values

MATLAB can now return a warning when it rounds up a number in converting to an integer data type. For example,

int8(2.7)
Warning: Conversion rounded non-integer floating point value to 
nearest int8 value.

ans =
   3

Integer Conversion of NaN

When MATLAB converts NaN (Not-a-Number) to an integer data type, the result is 0. MATLAB can now return a warning when this occurs. For example,

int16(NaN)
Warning: NaN converted to int16(0).

ans =
   0

Integer Conversion Overflow

MATLAB can now return a warning when you convert a number to an integer data type and the number is outside the range of the data type. For example,

int8(300)
Warning: Out of range value converted to intmin('int8') or 
intmax('int8').

ans =
   127

Integer Arithmetic Overflow

MATLAB can now return a warning when the result of an operation on integer data types is either NaN or outside the range of that data type. For example,

int8(100) + int8(100)
Warning: Out of range value or NaN computed in integer arithmetic.

ans =
   127

To turn all of these warnings off at once, enter

intwarning off

Warning on Concatenating Different Integer Classes

If you concatenate integer arrays of different integer classes, MATLAB displays the warning

Concatenation with dominant (left-most) integer class may 
overflow other operands on conversion to return class.

The class of the resulting array is the same as the dominant (or left-most) value in the concatenation:

a = int8([52 37 89; 23 16 47]);
b = int16([74 61 32; 98 73 25]);

% Combine int8 and int16 (int8 is dominant)
c = [a b];
class(c)
ans =
   int8

% Combine int16 and int8 (int16 is dominant)
c = [b a];
class(c)
ans =
   int16

Integer Data Type Functions Now Round Instead of Truncate

The following integer data functions now round noninteger inputs instead of truncating:

int8, uint8, int16, uint16, int32, uint32, int64, uint64

For example, in MATLAB 7.0,

int8(3.7) 

returns

ans =
    4

Compatibility Considerations

In previous releases, the same command returned 3. If you have code that contains these functions, it might return different results in Version 7.0 than in previous releases, in particular, results that differ by 1 after converting floating-point inputs to an integer data type.

You can turn the following warning on to help diagnose these differences:

warning on MATLAB:intCovertNonIntVal

See New Warnings for Integer Arithmetic for more information about this and other new warning messages.

Changes to Behavior of Concatenation

When you perform concatenation ([a, b], [a;b], and cat(a,b,dim)) on mixed integer and other numeric or logical inputs, the left-most integer type among the inputs is the type of the result. As a result, the other inputs might lose values when they are converted to the integer data type. In Version 7.0, MATLAB now returns a warning when you concatenate these mixed data types.

For example,

[int8(100) uint8(200)]
Warning: Concatenation with dominant (left-most) integer class 
may overflow other operands on conversion to return class.
(Type "warning off MATLAB:concatenation:integerInteraction" to 
suppress this warning.)

ans =
   100  127

class(ans)
ans =
   int8

Compatibility Considerations

Concatenating an input of any nondouble numeric data type (single and integer data type) with type char now returns a result of type char. In previous releases, the same operation returned a result of the same type as the numeric data type.

Class Input for realmax and realmin

You can now call the function realmax with the syntax

realmax('single')

ans =

  3.4028e+038

which returns the largest single-precision number. Similarly,

realmin('single') 

returns the smallest single-precision number.

The commands realmax('double') and realmin('double') return the same results as realmax and realmin, respectively. See Largest and Smallest Values for Floating-Point Classes in the online MATLAB Programming documentation for more information.

Class Input for ones, zeros, and eye

You can now call ones or zeros with an input argument specifying the data type of the output. For example,

ones(m, n, p, ...,  'single') 

or

ones([m, n, p, ...], 'single') 

returns an m-by-n-by-p-by ... array of type single containing all ones. zeros uses the same syntax.

You can now call eye with this input argument for two-dimensional arrays. For example,

eye(m, 'single') 

returns an m-by-m identity matrix of type single. The command

eye(m, n, 'int8') 

returns an m-by-n array of type int8.

Class and Size Inputs for Inf and NaN

The functions Inf and NaN now accept inputs that enable you to create Infs or NaNs of specified sizes and floating-point data types. As examples,

See the reference pages for Inf and NaN for more information.

New Class and Data Inputs for eps

You can now call the function eps with the syntax

eps(x)

If x has type double, eps(x) returns the distance from x to the next largest double-precision floating point number. This is a measure of the accuracy of x as a double-precision number. eps(1) returns the same value as eps with no input argument.

You can now replace expressions of the form

if Y < eps * abs(X)

with

if Y < eps(X)

If x has type single, eps(x) returns the distance from x to the next largest single-precision floating point number. This is a measure of the accuracy of x as a single-precision number.

The command

eps('single')
ans =
   1.1921e-007

returns the same value as eps(single(1)). The value of eps('single') is the same as single(2^-23). The command eps('double') returns the same result as eps.

See Accuracy of Floating-Point Data in the online MATLAB documentation for more information.

New Class Inputs for sum

The following new input arguments for sum control how the summation is performed on numeric inputs:

In Version 7.0, sum applied to a vector of type single performs single accumulation and returns a result of type single. In other words, sum(x) is the same as sum(x, 'native') if x has type single. This is a change in the behavior of sum from previous releases. To make sum accumulate in double, as in previous releases, use the input argument 'double'.

Compatibility Considerations

In Version 7.0, sum applied to a vector of type single performs single accumulation and returns a result of type single. In previous releases, sum performed this operation in double accumulation.

To restore the previous behavior, call sum with the syntax

sum(X, 'double')

or

sum(X, dim, 'double')

complex Now Accepts Inputs of Different Data Types

The function complex now accepts inputs of different data types when you use the syntax

complex(a,b)

according to the following rules:

Bit Functions Now Work on Unsigned Integers

The following functions now work on unsigned integer inputs:

bitand, bitcmp, bitget, bitor, bitset, bitshift, bitxor

Instead of using flints (integer values stored in floating point) to do your bit manipulations, consider using unsigned integers, as a more natural representation of bit strings. Instead of using bitmax, use the intmax function with the appropriate class name. For example, use intmax('uint32') if you are working with unsigned 32 bit integers.

In addition, the function bitcmp now accepts the following new syntax for inputs of type uint8, uint16, and uint32:

bitcmp(A)

bitcmp now uses the data type of A to determine how to take the bitwise complement.

New Function accumarray for Constructing Arrays with Accumulation

The new accumarray function enables you to construct an array with accumulation. The following example uses accumarray to construct a 5-by-5 matrix A from a vector val. The function accumarray adds the entries of val to A at the indices specified by the matrix ind, which has the same number of rows as val. If an index in ind is repeated, the entries of val accumulate at the corresponding entry of A.

ind = [1 2 5 5;1 2 5 5]';
val = [10.1 10.2 10.3 10.4]';
A  = accumarray(ind, val)

A =

   10.1000         0         0         0         0
         0   10.2000         0         0         0
         0         0         0         0         0
         0         0         0         0         0
         0         0         0         0   20.7000

To get the (5,5) entry of A, accumarray adds the entries of val corresponding to repeated pair of indices (5,5).

A(5, 5) = 10.3 + 10.4 

In general, if ind has ndim columns, A will be an N-dimensional array with ndim dimensions, whose size is max(ind).

Enhanced sort Capabilities and Performance

Improved Performance

sort performance has been improved for numeric arrays of randomly ordered data. Although there is some performance improvement for all such numeric arrays, you should see the greatest improvement for integer arrays and multidimensional arrays.

Sort Direction

A new argument, mode, lets you specify whether sort returns the sorted array in ascending or descending order.

New Functions for Numerical Data Types

MATLAB 7.0 contains three new functions for detecting and converting data types:

max and min Now Have Restrictions on Inputs of Different Data Types

In MATLAB 7.0, the functions max and min now have the following restrictions on inputs of different data types:

Other combinations of inputs now return an error message. In previous releases, inputs to max or min could have any combination of data types.

For the allowed mixed-type combinations listed above, max and min now return results of a different data type than in previous releases:

You can turn on the following warning messages to diagnose any issues that might result from this change in behavior:

Compatibility Considerations

Combinations of inputs other than those listed above now return an error message. Also, for these allowed mixed-type combinations, max and min now return results of a different data type than in previous releases:

Mathematic Operations on Logical Values

Most mathematic operations are not supported on logical values.

New Function linsolve for Solving Systems of Linear Equations

The new linsolve function enables you to solve systems of linear equations of the form Ax = b more quickly when the matrix of coefficients A has a special form, such as upper triangular. When you specify one of these special types of systems, linsolve is faster than mldivide or \ (backslash) because it does not check whether the matrix actually has the form you specify.

New Output for polyeig

The function polyeig can now return a vector of condition numbers for the eigenvalues, when you call it with the syntax

[X,E,S] = polyeig(A0,A1,..,Ap)

At least one of A0 and Ap must be nonsingular. Large condition numbers imply that the problem is close to one with multiple eigenvalues.

Enhancements to lscov

The command

lscov(A,b,V) 

now accepts either a weight vector or a covariance matrix for V. If you enter lscov(A,b) without a third argument, lscov uses the identity matrix for V.

The command lscov(A, b, V, alg) now enables you to specify the algorithm used to compute the result when V is a matrix. You can specify alg to be one of the following:

The command

[x stdx mse] = lscov(...)

now returns mse, the mean squared estimate (MSE).

The command

[x stdx mse S] = lscov(...) 

now returns S, the estimated covariance matrix of x.

In addition, lscov can now accept a design matrix A that is rank deficient and a covariance matrix, V, that is positive semidefinite.

New Form for Generalized Hessian

The function hess has a new syntax of the form

[AA,BB,Q,Z] = hess(A,B)

where A and B are square matrices, and returns an upper Hessenberg matrix AA, an upper triangular matrix BB, and unitary matrices Q and Z such that

Q*A*Z = AA

and

Q*B*Z = BB

New Function quadv Integrates Complex, Array-Valued Functions

The new function quadv integrates complex, array-valued functions.

New Trigonometric Functions For Angles in Degrees

The following new functions compute trigonometric functions of arguments in degrees.

Function

Purpose

sind

Compute the sine of an argument in degrees

cosd

Compute the cosine of an argument in degrees

tand

Compute the tangent of an argument in degrees

cotd

Compute the cotangent of an argument in degrees

secd

Compute the secant of an argument in degrees

cscd

Compute the cosecant of an argument in degrees

The following new functions compute the inverse trigonometric functions are return the answer in degrees:

Function

Purpose

asind

Compute the inverse sine of an argument and return answer in degrees

acosd

Compute the inverse cosine of an argument and return answer in degrees

atand

Compute the inverse tangent of an argument and return answer in degrees

acotd

Compute the inverse cotangent of an argument and return answer in degrees

asecd

Compute the inverse secant of an argument and return answer in degrees

acscd

Compute the inverse cosecant of an argument and return answer in degrees

Matrix, Trigonometric, and Other Math Functions No Longer Accept Inputs of Type char

Matrix functions, such as chol, lu, and svd, and trigonometric functions, such as sin and cos, no longer accept inputs of type char. In previous releases, these functions simply converted char inputs to double before performing operations on them.

Compatibility Considerations

To restore the previous behavior of these functions, create an M-file that converts its input to double before applying the function. For example, to restore the behavior of sin,

  1. Create a directory called @char in a directory on the MATLAB path, for example, your work directory.

  2. Create an M-file with the following commands:

    function s = sin(x)
    s = sin(double(x));
  3. Save the file as sin.m in the directory @char.

New Warnings for Complex Inputs to atan2, log2, and pow2

The following functions now return a warning for inputs that are not real numbers:

Enhanced Functions for Computational Geometry

The following functions, which perform geometric computations on a set of points in N-dimensional space, now provide many new options:

These functions now accept an input cell array options that gives you greater control over how they perform calculations. These functions use the software Qhull, created at the National Science and Technology Research Center for Computation and Visualization of Geometric Structures (the Geometry Center). For more information on the available options, see http://www.qhull.org/.

New Support for Interpolation Functions

The following interpolation functions now have enhanced features:

New and Enhanced Functions for Ordinary Differential Equations (ODEs)

MATLAB 7.0 provides two new functions for solving implicit ODEs and extending solutions to ODEs, along with several enhancements to existing ODE-related functions:

Enhancements to Discrete Fourier Transform Functions

The new function fftw enables you to optimize the speed of the discrete Fourier transform (DFT) functions fft, ifft, fft2, ifft2, fftn, and ifftn. You can use fftw to set options for a tuning algorithm that experimentally determines the fastest algorithm for computing a discrete Fourier transform of a particular size and dimension at run time.

The functions ifft, ifft2, and ifftn now accept the input argument 'symmetric', which causes these functions to treat the array X as conjugate symmetric. This option is useful when X is not exactly conjugate symmetric, merely because of round-off error.

FFT Functions Applied to Integer Data Types are Becoming Obsolete

In previous releases, the following fast Fourier transform (FFT) and related functions cast integer inputs of type uint8 and uint16 to double, used the double algorithm, and returned a double result:

In Version 7.0, these operations return warning messages that recommend convert the inputs to double before applying the function, for example, by fft(double(x)).

New Output Function for Optimization Functions

In MATLAB 7.0, you can create an output function for several optimization functions in MATLAB. The optimization function calls the output function at each iteration of its algorithm. You can use the output function to obtain information about the data at each iteration or to stop the algorithm based on the current values of the data. You can use the output function with the following optimization functions:

See Output Functions for an example of how to use the output function.

New Input Argument for Incomplete Gamma Function

The incomplete gamma function, gammainc, now accepts the input argument tail, using the syntax

Y = gammainc(X,A,tail)

tail specifies the tail of the incomplete gamma function when X is non-negative. The choices are for tail are 'lower' (the default) and 'upper'. The upper incomplete gamma function is defined as

1 - gammainc(x,a)

Overriding the Default BLAS Library on Intel/Windows Systems

MATLAB uses the Basic Linear Algebra Subroutines (BLAS) libraries to speed up matrix multiplication and LAPACK-based functions like eig, svd, and \ (mldivide). At start-up, MATLAB selects the BLAS library to use.

For R14, MATLAB still uses the ATLAS BLAS libraries, however, on Windows systems running on Intel processors, you can switch the BLAS library that MATLAB uses to the Math Kernel Library (MKL) BLAS, provided by Intel.

If you want to take advantage of the potential performance enhancements provided by the Intel BLAS, you can set the value of the environment variable BLAS_VERSION to the name of the MKL library, mkl.dll. MATLAB uses the BLAS specified by this environment variable, if it exists.

To set the BLAS_VERSION environment variable, follow this procedure:

  1. Click the Start button, go to the Settings menu, and select Control Panel.

  2. On the Control Panel menu, select System.

  3. In the System Properties dialog box, click the Advanced tab.

  4. On the Advanced panel, click the Environment Variables button.

  5. In the Environment Variables dialog box, click the New button in the User variables section.

  6. In the New User Variable dialog box, enter the name of the variable as BLAS_VERSION and set the value of the variable to the name of the MKL library: mkl.dll.

Multithreading Disabled in Intel Math Kernel Library (MKL) BLAS

The Intel Math Kernel Library (MKL) is multithreaded in several areas. By default, this threading capability is disabled. To enable threading in the MKL library, set the value of the OMP_NUM_THREADS environment variable. Intel recommends setting the value of the OMP_NUM_THREADS variable to the number of processors you want to use in your application.

To set the value of this environment variable, follow the instructions outlined in Overriding the Default BLAS Library on Intel/Windows Systems.

Before enabling multithreading, read the Intel Math Kernel Library 6.1 for Windows Technical User Notes that explains certain limitations of this capability.

New Names for Demos expm1, expm2, and expm3

The demos expm1, expm2, and expm3 have been renamed expmdemo1, expmdemo2, and expmdemo3, to avoid a name conflict with the new function expm1.

Compatibility Considerations

If you have code that relies on these function names, you will need to change the names in your code.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS