| Symbolic Math Toolbox | Search  Help Desk | |
| Arithmetic Operations | Examples | See Also |
Perform arithmetic operations on symbols.
A+B A-B A*B A.*B A\B A.\B A/B A./B A^B A.^B A' A.'
+A + B adds A and B. A and B must have the same dimensions, unless one is scalar.-A - B subtracts B from A. A and B must have the same dimensions, unless one is scalar.*A*B is the linear algebraic product of A and B. The number of columns of A must equal the number of rows of B, unless one is a scalar..*A.*B is the entry-by-entry product of A and B. A and B must have the same dimensions, unless one is scalar.\X = A\B solves the symbolic linear equations A*X=B. Note that A\B is roughly equivalent to inv(A)*B. Warning messages are produced if X does not exist or is not unique. Rectangular matrices A are allowed, but the equations must be consistent; a least squares solution is not computed..\A.\B is the matrix with entries B(i,j)/A(i,j). A and B must have the same dimensions, unless one is scalar./X=B/A solves the symbolic linear equation X*A=B. Note that B/A is the same as (A.'\B.'). Warning messages are produced if X does not exist or is not unique. Rectangular matrices A are allowed, but the equations must be consistent; a least squares solution is not computed../A./B is the matrix with entries A(i,j)/B(i,j). A and B must have the same dimensions, unless one is scalar.^X^P raises the square matrix X to the integer power P. If X is a scalar and P is a square matrix, X^P raises X to the matrix power P, using eigenvalues and eigenvectors. X^P, where X and P are both matrices, is an error..^A.^B is the matrix with entries A(i,j)^B(i,j). A and B must have the same dimensions, unless one is scalar.'A is complex, A' is the complex conjugate transpose..'A.' is the real transpose of A. A.' does not conjugate complex entries.syms a b c d; A = [a b; c d]; A*A/A A*A-A^2return
[ a, b] [ c, d] [ 0, 0] [ 0, 0]The following statements
syms a11 a12 a21 a22 b1 b2; A = [a11 a12; a21 a22]; B = [b1 b2]; X = B/A; x1 = X(1) x2 = X(2)return
x1 = (a21*b2-b1*a22)/(-a11*a22+a12*a21) x2 = (-a11*b2+a12*b1)/(-a11*a22+a12*a21)
null, solve