solve A*x=B
조회 수: 12 (최근 30일)
이전 댓글 표시
size of A is 566*664 and B is 566*1.......I tried every function like mldivide, A\b, linsolve but after getting x, when I multiply A with x it does not give me B Matrix.....What should be the reason? Is matrix wrong?
Please note that Rank of Matrix A is 461
댓글 수: 0
채택된 답변
James Tursa
2018년 9월 18일
편집: James Tursa
2018년 9월 18일
Sounds like you have inconsistent equations. The A\B calculation is doing the best that it can under these circumstances. E.g.,
>> A = [1 2 3;2 4 6] % <-- 2nd row is 2*1st row, so rank deficient
A =
1 2 3
2 4 6
>> B = [1;2] % <-- this particular B is consistent with both rows of A
B =
1
2
>> x = A\B
Warning: Rank deficient, rank = 1, tol = 4.4686e-015.
x =
0
0
0.3333
>> A*x % <-- works because equations are consistent
ans =
1
2
>>
>> B = [1;3] % <-- this particular B is not consistent with the rows of A
B =
1
3
>> x = A\B
Warning: Rank deficient, rank = 1, tol = 4.4686e-015.
x =
0
0
0.4667
>> A*x % <-- does not work because of the inconsistency. This is the best that backslash can do
ans =
1.4000
2.8000
How are your A and B variables being calculated?
댓글 수: 4
James Tursa
2018년 9월 18일
Look at my examples closely. When you have dependencies in the equations then you will need to have consistent right-hand-side values to match those dependencies in order to be able to find a solution. In my first example I did have that and I was able to find a solution such that A*x matched the B result. But in my second example the B values were not consistent with the dependencies in the A matrix. In this case the A\B is doing the best that it can, but it can't give you what you want because you didn't give it a system that could be solved like you want. It appears to me that this is what might be going on in your system of equations. You have dependencies among them (you admit that up front because your system is rank deficient), but the right-hand-side B values for these dependencies are not consistent. At least not consistent enough for you to get an answer that you are willing to accept.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear Algebra에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!