Mercurial > matrix-functions
comparison toolbox/poisson.m @ 0:8f23314345f4 draft
Create local repository for matrix toolboxes. Step #0 done.
author | Antonio Pino Robles <data.script93@gmail.com> |
---|---|
date | Wed, 06 May 2015 14:56:53 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:8f23314345f4 |
---|---|
1 function A = poisson(n) | |
2 %POISSON Block tridiagonal matrix from Poisson's equation (sparse). | |
3 % POISSON(N) is the block tridiagonal matrix of order N^2 | |
4 % resulting from discretizing Poisson's equation with the | |
5 % 5-point operator on an N-by-N mesh. | |
6 | |
7 % Reference: | |
8 % G.H. Golub and C.F. Van Loan, Matrix Computations, second edition, | |
9 % Johns Hopkins University Press, Baltimore, Maryland, 1989 | |
10 % (Section 4.5.4). | |
11 | |
12 S = tridiag(n,-1,2,-1); | |
13 I = speye(n); | |
14 A = kron(I,S) + kron(S,I); |