| Symbolic Math Toolbox | ![]() |
Syntax
R = inv(A)
Description
inv(A) returns inverse of the symbolic matrix A.
returnA = sym([2,-1,0;-1,2,-1;0,-1,2]);inv(A)
[ 3/4, 1/2, 1/4] [ 1/2, 1, 1/2] [ 1/4, 1/2, 3/4]The statements
syms a b c d A = [a b; c d] inv(A)return
[ d/(a*d-b*c), -b/(a*d-b*c)] [ -c/(a*d-b*c), a/(a*d-b*c)]Suppose you have created the following M-file.
%% Generate a symbolic N-by-N Hilbert matrix.
function A = genhilb(N)
syms t;
for i = 1:N
for j = 1:N
A(i,j) = 1/(i + j - t);
end
end
Then, the following statement
inv(genhilb(2))
returns
[ -(-3+t)^2*(-2+t), (-3+t)*(-2+t)*(-4+t)] [(-3+t)*(-2+t)*(-4+t), -(-3+t)^2*(-4+t)]the symbolic inverse of the 2-by-2 Hilbert matrix.
See Also
vpa
| int | iztrans | ![]() |