Error using inv Matrix must be square

4 ビュー (過去 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 Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by