[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Extracting the dominant eigenvector
From: |
A. Scottedward Hodel |
Subject: |
Re: Extracting the dominant eigenvector |
Date: |
Sat, 30 Mar 2002 16:11:10 -0600 (CST) |
User-agent: |
IMP/PHP IMAP webmail program 2.2.6 |
You need to be cautious: is the 10x10 matrix symmetric/hermitian? If not,
you may have complex eigenvalues, and the sort procedure may give you
unexpected results.
In the symmetric case, take a look at Golub and Van Loan's book, Matrix
Computations, in the chapter "The Symmetric Eigenvalue Problem." (Or
Beresford Parlett's book, 1984, by the same title.)
A power iteration may work if the largest eigenvalue is significantly larger
than the other eigenvalues:
while( not converged)
w = A*v
v = w/norm(w)
endwhile
If you've got a good estimate of the largest eigenvalue, you can use
while (not converged)
w = (A - lambda*eye(*n))\v
v = w/norm(w)
endwhile
to accelerate convergence.
Hope that helps some.
Quoting Mike Miller <address@hidden>:
> On Thu, 28 Mar 2002, Stefan Jonsson wrote:
>
> > Hello octave users
> >
> > I have what I hope is a simple problem
> >
> > I have a square matrix, A, currently 10by10, may at
> > later time have different dimensions.
> >
> > asking for eigenvalues and eigen vectors
> >
> > [vect, val] =eig(A);
> >
> > I need the dominant eigenvalue and corresponding eigenvector
>
>
> I suppose this will work for square matrix A of any size:
>
> k=size(A,1);
> [V,D]=eig(A);
> [S,I]=sort(diag(D));
> val=S(k);
> vec=V(:,I(k));
>
> You could write it as a function like this: [val, vec] = maxeig(A)
>
> I use the 'sort' function which returns index I. Read "help sort".
>
> Regards,
>
> Mike
>
> --
> Michael B. Miller, Ph.D.
> Assistant Professor
> Division of Epidemiology
> University of Minnesota
> http://taxa.epi.umn.edu/~mbmiller/
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web: http://www.octave.org
> How to fund new projects: http://www.octave.org/funding.html
> Subscription information: http://www.octave.org/archive.html
> -------------------------------------------------------------
>
A. S. Hodel Assoc Prof Dept. Elect. Eng., 200 Broun Hall
Auburn University, Auburn AL 36849-5201
http://www.eng.auburn.edu/~scotte
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------