?? sortem2.m
字號:
% James Javurek-Humig (3/15/05)%INPUTS: % matrix containing eigenvectors in its columns (vectors)% matrix containing the corresponding eigenvalues in a diagonal matrix% (values)%The two matricies are sorted from largest to smallest according to the%eigenvalue matrix.%RETURNS:% matrix containing the sorted eigenvectors% diagonal matrix containing the corresponding eigenvalues%This will give the same result as Matthew Dailey's sortem.m, but is much%faster for those who are worried about computational time.function [vectors values] = sortem2(vectors, values)%this error message is directly from Matthew Dailey's sortem.mif nargin ~= 2 error('Must specify vector matrix and diag value matrix')end;vals = max(values); %create a row vector containing only the eigenvalues[svals inds] = sort(vals,'descend'); %sort the row vector and get the indiciesvectors = vectors(:,inds); %sort the vectors according to the indicies from sortvalues = max(values(:,inds)); %sort the eigenvalues according to the indicies from sortvalues = diag(values); %place the values into a diagonal matrix
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -