Documentation Center

  • Trial Software
  • Product Updates
我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档

ldivide, .\

Left array division

Syntax

Description

example

x = B.\A divides each element of A by the corresponding element of B.

  • If A and B are arrays, then they must be the same size.

  • If either A or B is a scalar, then MATLAB® expands the scalar value into an appropriately sized array.

x = ldivide(B,A) is an alternative way to divide A by B, but is rarely used. It enables operator overloading for classes.

Examples

expand all

Divide Two Numeric Arrays

A = ones(2, 3);
B = [1 2 3; 4 5 6];
x = B.\A
x =

    1.0000    0.5000    0.3333
    0.2500    0.2000    0.1667

Divide a Scalar by a Numeric Array

C = 2;
D = [1 2 3; 4 5 6];
x = D.\C
x =

    2.0000    1.0000    0.6667
    0.5000    0.4000    0.3333

Input Arguments

expand all

A — Numeratornumeric array | sparse numeric array

Numerator, specified as a full or sparse numeric array. If B is an integer data type, then A must be the same integer type or a scalar double.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
Complex Number Support: Yes

B — Denominatornumeric array | sparse numeric array

Denominator, specified as a full or sparse numeric array. If A is an integer data type, then B must be the same integer type or a scalar double.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
Complex Number Support: Yes

Output Arguments

expand all

x — Solutionnumeric array | sparse numeric array

Solution, returned as a sparse or full numeric array. If either A or B are integer data types, then x is that same integer data type.

More About

expand all

Tips

  • MATLAB does not support complex integer division.

See Also

| |

Was this topic helpful?