The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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" <> wrote in news:eefb92c.-1

> 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]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.