System of equations with sparse linear equations

조회 수: 1 (최근 30일)
Ghady Hajj
Ghady Hajj 2018년 10월 29일
댓글: Ghady Hajj 2018년 10월 30일
Hello,
I have a sparse matrix A of size 65000x65000 only having 2's on the diagonal and 1's above and below the diagonal and the rest are zeros, and a system of equations in the form of X = A*B. The problem is that A is already a large matrix and MATLAB doesn't allow me to create such a vector to solve the equation.
Any ideas?

답변 (1개)

Torsten
Torsten 2018년 10월 30일
B is the unknown vector, A and X are given ?
Note that B can be determined by backward substitution:
n = 65000;
B = zeros(n,1);
B(n) = 0.5*X(n);
for i = n-1:-1:1
B(i) = (X(i)-B(i+1))*0.5
end
No need to form A explicitly.
Best wishes
Torsten.
  댓글 수: 3
Torsten
Torsten 2018년 10월 30일
If I'm not mistaken, you were first talking about a diagonal of 2's and 1's above the diagonal. Now I read that there are 1's also below the diagonal. For this case, the code from above does not work.
Try
Best wishes
Torsten.
Ghady Hajj
Ghady Hajj 2018년 10월 30일
Yeah sorry, that was a mistake, thank you!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by