23.12.2012 Views

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

eigs<br />

2-476<br />

eigs(Afun,n,k,sigma,opts,p1,p2,...) and<br />

eigs(Afun,n,B,k,sigma,opts,p1,p2,...) provide for additional arguments<br />

which are passed to Afun(x,p1,p2,...).<br />

Remarks d = eigs(A,k) is not a substitute for<br />

d = eig(full(A))<br />

d = sort(d)<br />

d = d(end-k+1:end)<br />

but is most appropriate for large sparse matrices. If the problem fits into<br />

memory, it may be quicker to use eig(full(A)).<br />

Algorithm eigs provides the reverse communication required by the Fortran library<br />

ARPACK, namely the routines DSAUPD, DSEUPD, DNAUPD, DNEUPD, ZNAUPD, and<br />

ZNEUPD.<br />

Examples Example 1: This example shows the use of function handles.<br />

A = delsq(numgrid('C',15));<br />

d1 = eigs(A,5,'sm');<br />

Equivalently, if dnRk is the following one-line function:<br />

function y = dnRk(x,R,k)<br />

y = (delsq(numgrid(R,k))) * x;<br />

then pass dnRk's additional arguments, 'C' and 15, to eigs.<br />

n = size(A,1);<br />

opts.issym = 1;<br />

d2 = eigs(@dnRk,n,5,'sm',opts,'C',15);<br />

Example 2: west0479 is a real 479-by-479 sparse matrix with both real and<br />

pairs of complex conjugate eigenvalues. eig computes all 479 eigenvalues. eigs<br />

easily picks out the largest magnitude eigenvalues.<br />

This plot shows the 8 largest magnitude eigenvalues of west0479 as computed<br />

by eig and eigs.<br />

load west0479<br />

d = eig(full(west0479))<br />

dlm = eigs(west0479,8)

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

Saved successfully!

Ooh no, something went wrong!