Sparse linear system of equations
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Jim Oste
am 16 Feb. 2015
Beantwortet: James Tursa
am 17 Feb. 2015
I'm given the following: [I_N - (N+1)^2]*B_N = V_N where N ≥ 3, I_N is and N x N identify matrix, B_N is the N x N matrix with (i,j)-th entry
B_N (i, j) =
0 if |i − j| > 1
−1 if |i − j| = 1
2 if |i − j| = 0
1<= i,j <= N
V_N is given and U_N is unknown. How would I right a function that sets up the B_N piece-wise and solved the linear system?
2 Kommentare
James Tursa
am 16 Feb. 2015
Please edit your question to make the problem more clear. E.g., you mention U_N is unknown, but U_N doesn't seem to appear in your problem statement.
Akzeptierte Antwort
James Tursa
am 17 Feb. 2015
Are you just asking how to construct B_N? E.g.,
B_N = spdiags(repmat([-1 2 -1],N,1),[-1 0 1],N,N);
A_N = speye(N) - ((N+1)^2)*B_N;
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Sparse Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!