inverse of a matrix wrong??

조회 수: 4 (최근 30일)
Giovanni Salviati
Giovanni Salviati 2019년 9월 7일
댓글: Walter Roberson 2019년 9월 8일
Hello community,
I've just written this code:
close all
clear all
clc
s = tf('s');
A = [0 , 1 ; -2 , -3]
B = [1 ; 0]
I = [1 , 0 ; 0 , 1]
L = s*I-A;
Linv = inv(L)
and it's not equal to my counts that I've done on the paper; infact the L matrix should be
s+3/(s^2+3*s+2) 1/(s^2+3*s+2)
-2/(s^2+3*s+2) s/(s^2+3*s+2)
while in matlab the last fraction ( row 2 , column 2) is: (s + 8.438e-15)/(s^2+3*s+2)

답변 (1개)

Walter Roberson
Walter Roberson 2019년 9월 7일
It is not wrong, but it is subject to round-off error; it also is not being simplified.
  댓글 수: 5
Giovanni Salviati
Giovanni Salviati 2019년 9월 8일
편집: Giovanni Salviati 2019년 9월 8일
Ok solved it.
I've just written "syms s", instead of "s = tf('s')"
but i don't get it why with the second function it doesn't work
Walter Roberson
Walter Roberson 2019년 9월 8일
The underlying code for tf and ss systems works with pure numeric matrices, and those have round off errors in calculations of matrix inverse. Matrix inverse numeric calculations are not done according to the formal definition of matrix inverse, because those calculations can take a long time.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by