How to produce an algorithm to solve a tridiagonal matrix?

2 Ansichten (letzte 30 Tage)
michael pritchard
michael pritchard am 20 Nov. 2015
Beantwortet: Steven Lord am 20 Nov. 2015
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

Antworten (1)

Steven Lord
Steven Lord am 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.

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!

Translated by