How to produce an algorithm to solve a tridiagonal matrix?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
How do I create an algorithm which solves a tridiagonal matrix for certain conditions, such as the following:
A: aij = {1 if i=j+-1},{4+h if i=j},{0 otherwise}
for when n=10 and h = 1/10
0 commentaires
Réponses (1)
Steven Lord
le 20 Nov 2015
Solve or create?
To solve a system of equations with that as its coefficient matrix, use backslash, LINSOLVE, one of the sparse iterative solvers like GMRES, etc.
To create the coefficient matrix itself, take a look at the help text for the two functions DIAG and SPDIAGS. Each contains an example that produces a matrix similar to your desired matrix; which to use depends on whether you want the result to be full or sparse, and that will probably be influenced by the value of n.
0 commentaires
Voir également
Catégories
En savoir plus sur Sparse Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!