Error using inv Matrix must be square

조회 수: 2 (최근 30일)
Marvin Castellanos
Marvin Castellanos 2015년 4월 7일
편집: Stephen23 2015년 4월 8일
So im pretty new to mathlab can someone just guide me and tell me what i am missing?
B =
0.0000 - 7.5700i 0.0000 + 3.3300i 0.0000 + 0.0000i 0.0000 + 3.3300i 0.0000 - 1.3600i
0.0000 + 3.3300i 0.0000 -16.6600i 0.0000 + 3.3300i 0.0000 +10.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i 0.0000 + 3.3300i 0.0000 - 7.7100i 0.0000 + 3.3300i 0.4100 - 1.5200i
0.0000 + 3.3300i 0.0000 +10.0000i 0.0000 + 3.3300i -17.6600 + 0.0000i -0.9000 - 1.2000i
>> inv(B) Error using inv Matrix must be square.

답변 (1개)

Stephen23
Stephen23 2015년 4월 7일
편집: Stephen23 2015년 4월 7일
Lets have a look at the size of this matrix:
>> B = [0-7.57i, 0+3.33i, 0+0.00i, 0+3.33i, 0-1.36i;...
0+3.33i, 0-16.66i, 0+3.33i, 0+10.i, 0.00+0.i;...
0+0.00i, 0+3.33i, 0-7.71i, 0+3.33i, 0.41-1.52i;...
0+3.33i, 0+10.i, 0+3.33i, -17.66+0.i, -0.90-1.20i];
>> size(B)
ans =
4 5
So the matrix is clearly not square. And yet the matrix inverse operation is only defined for square matrices: "inv(X) returns the inverse of the square matrix X" states the documentation clearly.
Every source you will care to look at will tell you that a matrix must be square to be invertable: "In linear algebra, an n-by-n square matrix A is called invertible..."
  댓글 수: 3
Torsten
Torsten 2015년 4월 7일
Maybe you mean
A=pinv(B)
?
Best wishes
Torsten.
Stephen23
Stephen23 2015년 4월 7일
편집: Stephen23 2015년 4월 8일
@Marvin Castellanos: when you can tell us what the inverse of a non-square matrix is, then we will show you how to code it.
There are some situations where a left / right inverse might be possible: "Non-square matrices (m-by-n matrices for which m ≠ n) do not have an inverse. However, in some cases such a matrix may have a left inverse or right inverse. If A is m-by-n and the rank of A is equal to n, then A has a left inverse: an n-by-m matrix B such that BA = I. If A has rank m, then it has a right inverse: an n-by-m matrix B such that AB = I."
Quoted from
But then you will need to tell us more about your matrix before we can tell you if this is possible.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by