Why do I get different answers for inverse?

조회 수: 2 (최근 30일)
Matlab_DJ
Matlab_DJ 2017년 3월 15일
답변: Carlos Felipe Rengifo 2018년 7월 6일
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
Carlos Felipe Rengifo 2018년 7월 6일
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