フィルターのクリア

Computing the inverse of a matrix without using the 'backslash' command

3 ビュー (過去 30 日間)
Nathaniel
Nathaniel 2012 年 7 月 12 日
So I am trying to compute the inverse of a matrix, and multiply it by another matrix. When I evaluate my code I get two answers on the order of 10^20. It is because the matrix is singular, and cannot be easily inverted. Is there a way my code can be evaluated to obtain correct values?
function solver=partone(Aee, Aet, Ate, Att, De, Dt)
A=[Aee Aet;Ate Att];
d=[De;Dt];
I=eye(2);
solver=(I-A)\d;
In my code I am using A=[.5 .3;.3 .82] and d=[110000;-40000]
  2 件のコメント
Sebastian Holmqvist
Sebastian Holmqvist 2012 年 7 月 12 日
"A square matrix that is not invertible is called singular or degenerate. A square matrix is singular if and only if its determinant is 0."
So is it singular or not? You can not invert a singular matrix since there's no inverse.
Nathaniel
Nathaniel 2012 年 7 月 12 日
The determinate of the matrix is zero so it would be singular. It is for a school project and there is a way to get an answer. I have been told that one of the solutions will approach infinity and the other will approach zero. I am unsure how to figure this out myself.

サインインしてコメントする。

採用された回答

Puneet Rana
Puneet Rana 2012 年 7 月 12 日
You can use the Moore-Penrose pseudoinverse as follows:
solver=pinv(I-A)*d
  2 件のコメント
Nathaniel
Nathaniel 2012 年 7 月 12 日
Thanks!
Richard Brown
Richard Brown 2012 年 7 月 13 日
You do realise that this is still not a "solution" to your equations though, right? They have no solution, because they are inconsistent.
Because they are inconsistent, the best you can do is find an x that minimises the (Euclidean norm of) the residual (I - A)*x - d. Because your system has rank 1, there is a 1D subspace of R^2 that has this property. The pinv solution presented here finds the x of minimum norm from this set of minimisers.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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