Why do I get different answers for inverse?
3 views (last 30 days)
Show older comments
Matlab_DJ
on 15 Mar 2017
Answered: Carlos Felipe Rengifo
on 6 Jul 2018
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) /
0 Comments
Accepted Answer
Carlos Felipe Rengifo
on 6 Jul 2018
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 Comments
More Answers (0)
See Also
Categories
Find more on Number Theory in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!