Mercurial > matrix-functions
annotate toolbox/poisson.m @ 2:c124219d7bfa draft
Re-add the 1995 toolbox after noticing the statement in the ~higham/mctoolbox/ webpage.
author | Antonio Pino Robles <data.script93@gmail.com> |
---|---|
date | Thu, 07 May 2015 18:36:24 +0200 |
parents | 8f23314345f4 |
children |
rev | line source |
---|---|
0
8f23314345f4
Create local repository for matrix toolboxes. Step #0 done.
Antonio Pino Robles <data.script93@gmail.com>
parents:
diff
changeset
|
1 function A = poisson(n) |
8f23314345f4
Create local repository for matrix toolboxes. Step #0 done.
Antonio Pino Robles <data.script93@gmail.com>
parents:
diff
changeset
|
2 %POISSON Block tridiagonal matrix from Poisson's equation (sparse). |
8f23314345f4
Create local repository for matrix toolboxes. Step #0 done.
Antonio Pino Robles <data.script93@gmail.com>
parents:
diff
changeset
|
3 % POISSON(N) is the block tridiagonal matrix of order N^2 |
8f23314345f4
Create local repository for matrix toolboxes. Step #0 done.
Antonio Pino Robles <data.script93@gmail.com>
parents:
diff
changeset
|
4 % resulting from discretizing Poisson's equation with the |
8f23314345f4
Create local repository for matrix toolboxes. Step #0 done.
Antonio Pino Robles <data.script93@gmail.com>
parents:
diff
changeset
|
5 % 5-point operator on an N-by-N mesh. |
8f23314345f4
Create local repository for matrix toolboxes. Step #0 done.
Antonio Pino Robles <data.script93@gmail.com>
parents:
diff
changeset
|
6 |
8f23314345f4
Create local repository for matrix toolboxes. Step #0 done.
Antonio Pino Robles <data.script93@gmail.com>
parents:
diff
changeset
|
7 % Reference: |
8f23314345f4
Create local repository for matrix toolboxes. Step #0 done.
Antonio Pino Robles <data.script93@gmail.com>
parents:
diff
changeset
|
8 % G.H. Golub and C.F. Van Loan, Matrix Computations, second edition, |
8f23314345f4
Create local repository for matrix toolboxes. Step #0 done.
Antonio Pino Robles <data.script93@gmail.com>
parents:
diff
changeset
|
9 % Johns Hopkins University Press, Baltimore, Maryland, 1989 |
8f23314345f4
Create local repository for matrix toolboxes. Step #0 done.
Antonio Pino Robles <data.script93@gmail.com>
parents:
diff
changeset
|
10 % (Section 4.5.4). |
8f23314345f4
Create local repository for matrix toolboxes. Step #0 done.
Antonio Pino Robles <data.script93@gmail.com>
parents:
diff
changeset
|
11 |
8f23314345f4
Create local repository for matrix toolboxes. Step #0 done.
Antonio Pino Robles <data.script93@gmail.com>
parents:
diff
changeset
|
12 S = tridiag(n,-1,2,-1); |
8f23314345f4
Create local repository for matrix toolboxes. Step #0 done.
Antonio Pino Robles <data.script93@gmail.com>
parents:
diff
changeset
|
13 I = speye(n); |
8f23314345f4
Create local repository for matrix toolboxes. Step #0 done.
Antonio Pino Robles <data.script93@gmail.com>
parents:
diff
changeset
|
14 A = kron(I,S) + kron(S,I); |