Main Content
ldivide, .\
Symbolic array left division
Syntax
Description
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 B.\sin(a)
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 left
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.
H.\d
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 = f.\(x^2 + 5*x + 6)
f1(x) = (x^2 + 5*x + 6)/x^2