Need help with matlab question
古いコメントを表示
i need to solve a linear system of equation Ax = b; involving any singular matrix, A i have tried doing:
>> A=[3 3;3 3]
A =
3 3
3 3
>> B=[1;1]
B =
1
1
>> X=linsolve(A,B)
but i jsut get the response "Warning: Matrix is singular to working precision."
where am i going wrong?
6 件のコメント
Guillaume
2017 年 12 月 8 日
I'm curious as to what result you would consider correct in such case?
Dan Smith
2017 年 12 月 8 日
Dan Smith
2017 年 12 月 8 日
Dan Smith
2017 年 12 月 8 日
Guillaume
2017 年 12 月 8 日
i have absolutely no knowledge on matlab
The problem with your question is nothing to do with matlab and everything to do with mathematics.
Mathematics tell you that
[3 3 * [X1 = [1
3 3] X2] 1]
has an infinity of solutions (all points on the line y=(1-3*x)/3) and that
[3 3 * [X1 = [1
3 3] X2] 0]
has no solution.
This is really basic linear algebra.
採用された回答
その他の回答 (1 件)
Birdman
2017 年 12 月 8 日
Look, now let's solve the question by hand and see what we will see. If you multiply A*x and equal to b, you will have two equations:
3*X1+3*X2=1;
3*X1+3*X2=1;
As you see, there are infinitely many solution to the problem, which results in no unique solution. This will happen when only there is a linear dependence between A's rows or columns, which in this case we see it. Therefore this problem has infinitely many solution. Do not search for a unique one. Also, take the determinant of A, which will be zero, which will prove that rows or columns are linearly dependent of A.
6 件のコメント
Dan Smith
2017 年 12 月 8 日
Birdman
2017 年 12 月 8 日
It will be same thing Dan, as long as there is a linear dependence between rows and columns of A(in other words, the determinant of A is zero).
Consider A=[1 2;3 4];b=[3 5].
There will be a unique solution for this since there is no linear dependence between rows and columns of A.
Dan Smith
2017 年 12 月 8 日
Birdman
2017 年 12 月 8 日
I mean that first column of A is a real multiple of second column or vice versa. Same goes for the rows.
Dan Smith
2017 年 12 月 8 日
John D'Errico
2017 年 12 月 8 日
編集済み: John D'Errico
2017 年 12 月 8 日
Read my answer, where I explain in some detail why that can never happen for singular A, and when a solution will exist, and why there will be infinitely many solutions.
カテゴリ
ヘルプ センター および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!