a — Real component scalar | vector | matrix | multidimensional array

Real component, specified as a scalar, vector, matrix, or multidimensional
array.

The size of a must match the size of b,
unless one is a scalar. If either a or b is
a scalar, MATLAB^{®} expands the scalar to match the size of the
other input.

a and b must be the same
data type with the following exceptions:

single can combine with double.

scalar double can combine with
an integer data type.

Imaginary component, specified as a scalar, vector, matrix,
or multidimensional array.

The size of b must match the size of a,
unless one is a scalar. If either a or b is
a scalar, MATLAB expands the scalar to match the size of the
other input.

a and b must be the same
data type with the following exceptions:

single can combine with double.

scalar double can combine with
an integer data type.

Complex array, returned as a scalar, vector, matrix, or multidimensional
array.

The size of z is the same as the input arguments.

The following describes the data type of z,
when a and b have different
data types.

If either a or b is single,
then z is single.

If either a or b is
an integer data type, then z is the same integer
data type.

Tips

If b contains only zeros, then z is
complex and the value of all its imaginary components is 0.
In contrast, the addition a + 0i returns a strictly
real result.

Extended Capabilities

Tall Arrays Calculate with arrays that have more rows than fit in memory.

This function fully supports tall arrays. For
more information, see Tall Arrays.

C/C++ Code Generation Generate C and C++ code using MATLAB® Coder™.

GPU Code Generation Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

GPU Arrays Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.

This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).

Distributed Arrays Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.