15.11.2014 Views

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

6 Sparse Matrices<br />

set up the five-point Laplacian difference operator on a 65-by-65 grid in an<br />

L-shaped, two-dimensional domain. The statements<br />

size(A)<br />

nnz(A)<br />

show that A is a matrix <strong>of</strong> order 2945 with 14,473 nonzero elements.<br />

The statement<br />

[v,d] = eigs(A,1,0);<br />

computes the smallest eigenvalue and eigenvector. Finally,<br />

L(L>0) = full(v(L(L>0)));<br />

x = -1:1/32:1;<br />

contour(x,x,L,15)<br />

axis square<br />

distributes the components <strong>of</strong> the eigenvector over the appropriate grid points<br />

and produces a contour plot <strong>of</strong> the result.<br />

1<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0<br />

−0.2<br />

−0.4<br />

−0.6<br />

−0.8<br />

−1<br />

−1 −0.5 0 0.5 1<br />

The numerical techniques used in eigs and svds are described in [6].<br />

6-40

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!