Why do I get different answers for inverse?

2 次查看(过去 30 天)
I'm not sure what's going on here. Same numbers, but using inv() gives me different answers than finding the inverse using adjoint over determinate.
clc;clear all;
syms s a
a = [ [0 1 0] ;
[-2 -4 1] ;
[0 0 6];];
matrix = s*eye(3) - a;
xs = inv(matrix) * [0;0;1;] *(1/(s+1))
pretty(xs)
b=adjoint(matrix);
c=det(matrix);
x2s = (b/c)* [0;0;1;] * (1/(s+1)) ;
pretty(x2s)
gives me
xs =
-1/((s + 1)*(- s^3 + 2*s^2 + 22*s + 12))
-s/((s + 1)*(- s^3 + 2*s^2 + 22*s + 12))
1/((s + 1)*(s - 6))
/ 1 \
| - --------------------------------- |
| 3 2 |
| (s + 1) (- s + 2 s + 22 s + 12) |
| |
| s |
| - --------------------------------- |
| 3 2 |
| (s + 1) (- s + 2 s + 22 s + 12) |
| |
| 1 |
| --------------- |
\ (s + 1) (s - 6) /
/ 1 \
| - --------------------------------- |
| 3 2 |
| (s + 1) (- s + 2 s + 22 s + 12) |
| |
| s |
| - --------------------------------- |
| 3 2 |
| (s + 1) (- s + 2 s + 22 s + 12) |
| |
| 2 |
| s + 4 s + 2 |
| - --------------------------------- |
| 3 2 |
\ (s + 1) (- s + 2 s + 22 s + 12) /

采纳的回答

Carlos Felipe Rengifo
The variables "xs" and "x2s" contain equivalent mathematical expressions. The variable "xs" is a simplified version of the variable "x2s". You can verify this by writing the following sentence:
>> simplify(xs-x2s)
ans =
0
0
0

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Number Theory 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by