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!