Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Return column index (easy question)
Replies: 3   Last Post: Feb 12, 2005 9:35 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Donald R. Fredkin

Posts: 3
Registered: 2/16/05
Re: Return column index (easy question)
Posted: Feb 11, 2005 9:14 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Tim Booher" <ads@theboohers.org> wrote in news:eefb92c.-1
@webx.raydaftYaTP:

> I am trying to return a maximum eigenvalue and its associated
> eigenvector, but can't because I don't know how to find the column
> number associated with the maximum eigenvalue. For example,
>
> [v d]=eig([1 2 3; 4 5 6; 7 8 9]);
>
> max_eig_val=max(max(d));
> max_eig_vec=v(:,??);
>
> What can I put in for ??. ColumnIndex(max(max(d))) would be great if
> it existed.


How about

[v d]=eig([1 2 3; 4 5 6; 7 8 9]);
[max_eig_val, max_eig_idx] = max(diag(d));
max_eig_vec = v(:,max_eig_idx);



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.