| Mathematics, MATLAB Version 7 (R14) Release Notes | ![]() |
This version introduces the following new features and changes:
New Function accumarray for Constructing Arrays with Accumulation
max and min Now Have Restrictions on Inputs of Different Data Types
This release introduces the following new functions:
Function | Description |
|---|---|
Construct array with accumulation | |
Cast variable to different type | |
Compute exp(x)-1 accurately for small values of x | |
Largest value of specified integer type | |
Smallest value of specified integer type | |
Control state of integer warnings | |
Determine whether input is floating-point array | |
Determine whether input is integer array | |
Solve linear system of equations | |
Compute log(1+x) accurately for small values of x | |
Real nth root of real numbers | |
Solve fully implicit differential equations, variable order method | |
Extend solution of initial value problem for ordinary differential equation | |
Vectorized quadrature |
The functions listed in the left column of the following table are obsolete and will be removed from a future version of MATLAB.
Use the replacement functions listed in the right column instead.
Obsolete Function | Replacement Function |
|---|---|
colmmd | |
quad8 | |
symmmd |
The following obsolete functions are no longer included in MATLAB:
fmin, fmins, icubic, interp4, interp5, interp6, meshdom, nnls, saxis
MATLAB Version 7.0 supports many arithmetic operations and mathematical functions on the following nondouble MATLAB data types:
single
int8 and uint8
int16 and uint16
int32 and uint32
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.
Note In Version 7.0, MATLAB only supports mathematical operations on nondouble data types for built-in functions; it does not support these operations for M-file functions unless otherwise stated in the M-file help. |
This section describes how MATLAB performs arithmetic on nondouble data types.
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.
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.
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.
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
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
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
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 =
127MATLAB 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
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
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 =
4In 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.
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
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.
You can now call the function realmax with the syntax
realmax('single')
ans =
3.4028e+038which 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.
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.
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,
Inf('single') or NaN('single') create the single-precision representations of Inf and NaN, respectively.
Inf(m,n,p, ...) or NaN(m,n,p,...) create m-by-n-by-p-by-... arrays of Infs or NaNs, respectively.
See the reference pages for Inf and NaN for more information.
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-007returns 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.
The following new input arguments for sum control how the summation is performed on numeric inputs:
s = sum(x,'native') and s = sum(x, dim,'native') accumulate in the native type of its input and the output s has the same data type as x. This is the default for single and double.
s = sum(x,'double') and s = sum(x, dim, 'double') accumulate in double-precision. This is the default for integer data types.
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'.
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')
The function complex now accepts inputs of different data types when you use the syntax
complex(a,b)
according to the following rules:
If either of a or b has type single, c has type single.
If either of a or b has an integer data type, the other must have the same integer data type or type scalar double, and c has the same integer data type.
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.
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.7000To 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).
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.
A new argument, mode, lets you specify whether sort returns the sorted array in ascending or descending order.
MATLAB 7.0 contains three new functions for detecting and converting data types:
cast enables you to cast a variable to a different data type or class
isfloat enables you to detect floating-point arrays. isfloat(A) returns 1 if A has type double or single and 0 otherwise. isfloat(A) is the same as isa(A,'float').
isinteger enables you to detect integer arrays. isinteger(A) returns 1 if A has integer data type and 0 otherwise. isinteger(A) is the same as isa(A,'integer')
In MATLAB 7.0, the functions max and min now have the following restrictions on inputs of different data types:
If any input has an integer data type, all other inputs must have the same integer data type or type scalar double.
If any input is of type single, all other inputs must have type double or single.
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:
If one input has an integer data type, while another has type double, the result now has the same integer data type. In previous releases, the result had type double.
If one input has type single, while another has type double, the result now has type single. In previous releases, the result had type double.
You can turn on the following warning messages to diagnose any issues that might result from this change in behavior:
warning on MATLAB:max:mixedIntegersScalarDoubleInputs
warning on MATLAB:max:mixedSingleDoubleInputs
warning on MATLAB:min:mixedIntegersScalarDoubleInputs
warning on MATLAB:min:mixedSingleDoubleInputs
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:
Most mathematic operations are not supported on logical values.
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.
Note If the matrix A does not have the form you specify in opts, linsolve returns incorrect results because it does not perform error checking. If you are unsure of the form of A, use mldivide, or \ instead. |
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.
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:
'chol' uses the Cholesky decomposition of V
'orth' uses the orthogonal decomposition of V
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.
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
The new function quadv integrates complex, array-valued functions.
The following new functions compute trigonometric functions of arguments in degrees.
Function | Purpose |
|---|---|
Compute the sine of an argument in degrees | |
Compute the cosine of an argument in degrees | |
Compute the tangent of an argument in degrees | |
Compute the cotangent of an argument in degrees | |
Compute the secant of an argument in degrees | |
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 |
|---|---|
Compute the inverse sine of an argument and return answer in degrees | |
Compute the inverse cosine of an argument and return answer in degrees | |
Compute the inverse tangent of an argument and return answer in degrees | |
Compute the inverse cotangent of an argument and return answer in degrees | |
Compute the inverse secant of an argument and return answer in degrees | |
Compute the inverse cosecant of an argument and return answer in degrees |
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.
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,
Create a directory called @char in a directory on the MATLAB path, for example, your work directory.
Create an M-file with the following commands:
function s = sin(x) s = sin(double(x));
The following functions now return a warning for inputs that are not real numbers:
atan2(y,x)
[f,e] = log2(x)
pow2(f,e)
The following functions, which perform geometric computations on a set of points in N-dimensional space, now provide many new options:
convhull — Compute convex hulls
convhulln — Compute N-dimensional convex hulls
delaunay — Construct Delaunay triangulation
delaunay3 — Construct 3-dimensional Delaunay tessellations
delaunayn — Construct N-dimensional Delaunay tessellations
griddata — Data gridding and surface fitting
griddata3 — Data gridding and surface fitting for 3-dimensional data
griddatan — Data gridding and hypersurface fitting (dimensions >= 2)
voronoi — Construct Voronoi diagrams
voronoin — Construct N-dimensional Voronoi diagrams
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/.
The following interpolation functions now have enhanced features:
interp1 — The command YI = interp1(X,Y,XI) now accepts a multidimensional array Y and returns an array of the correct dimensions. If Y is an array of size [n,m1,m2,...,mk], interp1 performs interpolation for each m1-by-m2-by-...-mk value in Y. If XI is an array of size [d1,d2,...,dj], YI has size [d1,d2,...,dj,m1,m2,...,mk].
The command pp = interp1(X,Y,'method','pp') uses the specified method to generate the piecewise polynomial form (ppform) of Y. See the reference page for interp1 for information about the available methods.
interp2, interp3, and interpn — You can now pass in a scalar argument, ExtrapVal, which these functions return for any values of XI and YI that lie outside the range of values spanned by X and Y defining the grid. For example,
ZI = interp2(X,Y,Z,XI,YI,'method',ExtrapVal)
returns the value of ExtrapVal for any values of XI or YI that are outside the range of values spanned by X and Y.
ppval now accepts multidimensional arrays returned by the spline function using the syntax
YY = ppval(spline(X,Y), XX)
Each entry of YY is obtained by evaluating spline(X,Y) at the corresponding value of XX.
spline — The command YY = spline(X,Y,XX) now accepts a multidimensional array Y and returns an array of the correct dimensions. Note that YY = spline(X,Y,XX) is the same as YY = ppval(spline(X,Y), XX).
If spline(X, Y) is scalar-valued, then YY is of the same size as XX. If spline(X, Y)is [D1,..,Dr]-valued, and XX has size [N1,...,Ns], then YY has size [D1,...,Dr, N1,...,Ns], where YY(:,...,:, J1,...,Js) is the value of spline(X, Y) at XX(J1,...,Js). There are two exceptions to this rule:
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:
ode15i, which
is new in Version 7.0, provides the capability to solve fully implicit
ODE and DAE problems of the form
with consistent initial conditions,
i.e.,
. ode15i provides an interface
that is similar to that of the other MATLAB ODE solvers and is as
easy to use. A supporting function decic helps
you calculate consistent initial conditions. The existing functions odeset and odeget enable you to set
integration properties that affect the problem solution. deval evaluates the numerical solution obtained with ode15i.
odextend, which is new in Version 7.0, enables you to extend the solution to an ODE created by an ODE solver.
bvp4c can now solve multipoint boundary value problems. To see an example of how to solve a three-point boundary value problem, enter threebvp. To see the code for the example, enter edit threebvp. Enter help bvp4c to learn more about bvp4c.
deval can now evaluate the derivative of the solution to an ODE as well as the solution itself. The command
[psxint, spxint] = deval(sol,xint)
returns spxint, the value of the derivative to sol.
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.
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)).
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.
N1 is ignored if XX is a row vector, that is, if N1 is 1 and s is 2.
spline ignores any trailing singleton dimensions of XX.
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)
Note Intel has used aggressive optimization to compile MKL. This optimization causes NaNs to be treated as zeros in some situations. Calculations that do not involve NaNs are done correctly. In some calculations that do involve NaNs, the NaNs will not propagate. |
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:
Click the Start button, go to the Settings menu, and select Control Panel.
In the System Properties dialog box, click the Advanced tab.
On the Advanced panel, click the Environment Variables button.
In the Environment Variables dialog box, click the New button in the User variables section.
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.
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.
The demos expm1, expm2, and expm3 have been renamed expmdemo1, expmdemo2, and expmdemo3, to avoid a name conflict with the new function expm1.
If you have code that relies on these function names, you will need to change the names in your code.
![]() | Desktop Tools and Development Environment, MATLAB Version 7 (R14) | Programming, MATLAB Version 7 (R14) | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |