Main Content

rdivide, ./

Symbolic array right division

Description

example

A./B divides A by B.

rdivide(A,B) is equivalent to A./B.

Examples

Divide Scalar by Matrix

Create a 2-by-3 matrix.

B = sym('b', [2 3])
B =
[ b1_1, b1_2, b1_3]
[ b2_1, b2_2, b2_3]

Divide the symbolic expression sin(a) by each element of the matrix B.

syms a
sin(a)./B
ans =
[ sin(a)/b1_1, sin(a)/b1_2, sin(a)/b1_3]
[ sin(a)/b2_1, sin(a)/b2_2, sin(a)/b2_3]

Divide Matrix by Matrix

Create a 3-by-3 symbolic Hilbert matrix and a 3-by-3 diagonal matrix.

H = sym(hilb(3))
d = diag(sym([1 2 3]))
H =
[   1, 1/2, 1/3]
[ 1/2, 1/3, 1/4]
[ 1/3, 1/4, 1/5]
 
d =
[ 1, 0, 0]
[ 0, 2, 0]
[ 0, 0, 3]

Divide d by H by using the elementwise right division operator .\. This operator divides each element of the first matrix by the corresponding element of the second matrix. The dimensions of the matrices must be the same.

d./H
ans =
[ 1, 0,  0]
[ 0, 6,  0]
[ 0, 0, 15]

Divide Expression by Symbolic Function

Divide a symbolic expression by a symbolic function. The result is a symbolic function.

syms f(x)
f(x) = x^2;
f1 = (x^2 + 5*x + 6)./f
f1(x) =
(x^2 + 5*x + 6)/x^2

Input Arguments

collapse all

Input, specified as a symbolic scalar variable, matrix variable, function, matrix function, expression, or vector, matrix, or array of symbolic scalar variables. Inputs A and B must be the same size unless one is a scalar. A scalar value expands into an array of the same size as the other input.

Input, specified as a symbolic scalar variable, matrix variable, function, matrix function, expression, or vector, matrix, or array of symbolic scalar variables. Inputs A and B must be the same size unless one is a scalar. A scalar value expands into an array of the same size as the other input.

Version History

Introduced before R2006a

expand all