inv
Inverse of symbolic matrix
Syntax
Description
Examples
Compute the inverse of a matrix of symbolic numbers.
A = sym([2 -1 0; -1 2 -1; 0 -1 2]); D = inv(A)
D =
Compute the inverse of a matrix of symbolic scalar variables.
syms a b c d A = [a b; c d]; D = inv(A)
D =
Compute the inverse of the Hilbert matrix that contains symbolic numbers.
D = inv(sym(hilb(4)))
D =
Find the inverse of a 4-by-4 block matrix
where and are 2-by-2 submatrices. The notation represents a 2-by-2 submatrix of zeros.
Use symbolic matrix variables to represent the submatrices in the block matrix.
syms A B [2 2] matrix Z = symmatrix(zeros(2))
Z =
C = [A Z; Z B]
C =
Find the inverse of the matrix .
D = inv(C)
D =
To show the elements of the inverse matrix, convert the result from a symbolic matrix variable to symbolic scalar variables using symmatrix2sym
.
D1 = symmatrix2sym(D)
D1 =
Compute the inverse of the matrix polynomial , where is a 2-by-2 matrix.
Create the matrix as a symbolic matrix variable and the coefficient as a symbolic scalar variable. Create the matrix polynomial as a symbolic matrix function f
with and as its parameters.
syms A [2 2] matrix syms a0 syms f(a0,A) [2 2] matrix keepargs f(a0,A) = a0*eye(2) + A
f(a0, A) =
Find the inverse of f
using inv
. The result is a symbolic matrix function of type symfunmatrix
that accepts scalars, vectors, and matrices as its input arguments.
fInv = inv(f)
fInv(a0, A) =
Convert the result from the symfunmatrix
data type to the symfun
data type using symfunmatrix2symfun
. The result is a symbolic function that accepts scalars as its input arguments.
gInv = symfunmatrix2symfun(fInv)
gInv(a0, A1_1, A1_2, A2_1, A2_2) =
Input Arguments
Input matrix, specified as a square numeric matrix, square matrix of symbolic scalar variables, square symbolic matrix variable, square symbolic matrix function, or symbolic expression with square size.
Data Types: single
| double
| sym
| symmatrix
| symfunmatrix
Tips
Matrix computations involving many symbolic variables can be slow. To increase the computational speed, reduce the number of symbolic variables by substituting the given values for some variables.
Version History
Introduced before R2006aThe inv
function accepts an input argument of type
symfunmatrix
. For an example, see Compute Inverse of Matrix Polynomial.
The inv
function accepts an input argument of type
symmatrix
. For an example, see Compute Inverse of Block Matrix.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)