eig versus svd functions to calculate eigenvalues of complex matrix
9 views (last 30 days)
Show older comments
Hello,
I use the eig and svd respectively to calculate the eigenvalues of a 7*7 complex matrix, which is the result of FFT, but I get different results from the two funcion,
K=[-0.469586517065409 + 0.175378013674380i,-0.162669155608248 + 0.474138893683794i,0.187585296250523 + 0.464844814234381i,-0.0470935259817215 - 0.499050242461219i,0.501128494899033 - 0.0117973001242788i,-0.491929587334346 + 0.0963027818655986i,-0.491929587334346 + 0.0963027818655986i;-0.162669155608248 + 0.474138893683794i,0.263016111526474 + 0.426721770908734i,0.478226533722468 + 0.150227584463661i,-0.415448433490139 - 0.280484480498623i,0.309072541453745 - 0.394643014393155i,-0.237946127637339 + 0.441192231382635i,-0.237946127637339 + 0.441192231382635i;0.187585296250523 + 0.464844814234381i,0.478226533722468 + 0.150227584463661i,0.459785835505823 - 0.199664544068809i,-0.497649694446211 + 0.0601142770694749i,-0.0248843875256234 - 0.500649290369484i,0.109120724497475 + 0.489245962860338i,0.109120724497475 + 0.489245962860338i;-0.0470935259817215 - 0.499050242461219i,-0.415448433490139 - 0.280484480498623i,-0.497649694446211 + 0.0601142770694749i,0.494104399695533 + 0.0844380654178533i,-0.119058443001582 + 0.486923024553196i,0.0350717196883265 - 0.500038917653513i,0.0350717196883265 - 0.500038917653513i;0.501128494899033 - 0.0117973001242788i,0.309072541453745 - 0.394643014393155i,-0.0248843875256234 - 0.500649290369484i,-0.119058443001582 + 0.486923024553196i,-0.477319052929875 - 0.153086467070477i,0.496322714229578 + 0.0702332402056026i,0.496322714229578 + 0.0702332402056026i;-0.491929587334346 + 0.0963027818655986i,-0.237946127637339 + 0.441192231382635i,0.109120724497475 + 0.489245962860338i,0.0350717196883265 - 0.500038917653513i,0.496322714229578 + 0.0702332402056026i,-0.501053513999558 + 0.0146396994056337i,-0.501053513999558 + 0.0146396994056337i;-0.491929587334346 + 0.0963027818655986i,-0.237946127637339 + 0.441192231382635i,0.109120724497475 + 0.489245962860338i,0.0350717196883265 - 0.500038917653513i,0.496322714229578 + 0.0702332402056026i,-0.501053513999558 + 0.0146396994056337i,-0.501053513999558 + 0.0146396994056337i];
[~,S1,~]=svd(K);
[~,S2]=eig(K);
The primary eigenvalue from svd is real and the one from eig is complex. Based on my set, I know that svd gives the correct result, but I have no idea what causes this difference. Will you please give me any hints why this will occur? Besides, is there some useful algorithm to calculate the eigenvector of a normal complex matrix?
Any help would be highly appreciated!
Qiping
0 Comments
Accepted Answer
Walter Roberson
on 17 Feb 2022
K=[-0.469586517065409 + 0.175378013674380i,-0.162669155608248 + 0.474138893683794i,0.187585296250523 + 0.464844814234381i,-0.0470935259817215 - 0.499050242461219i,0.501128494899033 - 0.0117973001242788i,-0.491929587334346 + 0.0963027818655986i,-0.491929587334346 + 0.0963027818655986i;-0.162669155608248 + 0.474138893683794i,0.263016111526474 + 0.426721770908734i,0.478226533722468 + 0.150227584463661i,-0.415448433490139 - 0.280484480498623i,0.309072541453745 - 0.394643014393155i,-0.237946127637339 + 0.441192231382635i,-0.237946127637339 + 0.441192231382635i;0.187585296250523 + 0.464844814234381i,0.478226533722468 + 0.150227584463661i,0.459785835505823 - 0.199664544068809i,-0.497649694446211 + 0.0601142770694749i,-0.0248843875256234 - 0.500649290369484i,0.109120724497475 + 0.489245962860338i,0.109120724497475 + 0.489245962860338i;-0.0470935259817215 - 0.499050242461219i,-0.415448433490139 - 0.280484480498623i,-0.497649694446211 + 0.0601142770694749i,0.494104399695533 + 0.0844380654178533i,-0.119058443001582 + 0.486923024553196i,0.0350717196883265 - 0.500038917653513i,0.0350717196883265 - 0.500038917653513i;0.501128494899033 - 0.0117973001242788i,0.309072541453745 - 0.394643014393155i,-0.0248843875256234 - 0.500649290369484i,-0.119058443001582 + 0.486923024553196i,-0.477319052929875 - 0.153086467070477i,0.496322714229578 + 0.0702332402056026i,0.496322714229578 + 0.0702332402056026i;-0.491929587334346 + 0.0963027818655986i,-0.237946127637339 + 0.441192231382635i,0.109120724497475 + 0.489245962860338i,0.0350717196883265 - 0.500038917653513i,0.496322714229578 + 0.0702332402056026i,-0.501053513999558 + 0.0146396994056337i,-0.501053513999558 + 0.0146396994056337i;-0.491929587334346 + 0.0963027818655986i,-0.237946127637339 + 0.441192231382635i,0.109120724497475 + 0.489245962860338i,0.0350717196883265 - 0.500038917653513i,0.496322714229578 + 0.0702332402056026i,-0.501053513999558 + 0.0146396994056337i,-0.501053513999558 + 0.0146396994056337i];
[~,S1,~]=svd(K)
[V2,S2]=eig(K)
temp = K'*K;
[~, temp2] = eig(temp);
S3 = sqrt(temp2)
[~, S4] = eig(K)
format long g
sort(diag(S1), 'descend')
sort(diag(S3), 'descend')
double(sort(diag(S4), 'descend'))
The complex parts are due to round-off error (and probably the nearly-zero parts are as well.)
Why are they diffferent? Well, SVD is defined in a way that only matches eig() when the matrix is square and real. eigenvalues involve the roots of a polynomial, and when the polynomial does not have real components it it certain that the roots will not all be real valued and non-negative and so cannot be the same as the singular values.
Singular values might be what you need for your purpose, but do not mistake them as being the eigenvalues of a complex matrix.
2 Comments
Paul
on 17 Feb 2022
"SVD is defined in a way that only matches eig() when the matrix is square and real."
Did you mean "matches" in a literal sense? I don't think that's the case
M = [1 0.2;3 4];
eig(M)
svd(M)
More Answers (1)
AndresVar
on 17 Feb 2022
I saw an answer Student in stackexchange that says eigenvalues and singular values coincide for a matrix that is real symmetric with non-negative eigenvalues
For the complex matrix K you can say singular values of K squared are equal to eigen values of K*K' (note ' is the conjugate transpose)
K=[-0.469586517065409 + 0.175378013674380i,-0.162669155608248 + 0.474138893683794i,0.187585296250523 + 0.464844814234381i,-0.0470935259817215 - 0.499050242461219i,0.501128494899033 - 0.0117973001242788i,-0.491929587334346 + 0.0963027818655986i,-0.491929587334346 + 0.0963027818655986i;-0.162669155608248 + 0.474138893683794i,0.263016111526474 + 0.426721770908734i,0.478226533722468 + 0.150227584463661i,-0.415448433490139 - 0.280484480498623i,0.309072541453745 - 0.394643014393155i,-0.237946127637339 + 0.441192231382635i,-0.237946127637339 + 0.441192231382635i;0.187585296250523 + 0.464844814234381i,0.478226533722468 + 0.150227584463661i,0.459785835505823 - 0.199664544068809i,-0.497649694446211 + 0.0601142770694749i,-0.0248843875256234 - 0.500649290369484i,0.109120724497475 + 0.489245962860338i,0.109120724497475 + 0.489245962860338i;-0.0470935259817215 - 0.499050242461219i,-0.415448433490139 - 0.280484480498623i,-0.497649694446211 + 0.0601142770694749i,0.494104399695533 + 0.0844380654178533i,-0.119058443001582 + 0.486923024553196i,0.0350717196883265 - 0.500038917653513i,0.0350717196883265 - 0.500038917653513i;0.501128494899033 - 0.0117973001242788i,0.309072541453745 - 0.394643014393155i,-0.0248843875256234 - 0.500649290369484i,-0.119058443001582 + 0.486923024553196i,-0.477319052929875 - 0.153086467070477i,0.496322714229578 + 0.0702332402056026i,0.496322714229578 + 0.0702332402056026i;-0.491929587334346 + 0.0963027818655986i,-0.237946127637339 + 0.441192231382635i,0.109120724497475 + 0.489245962860338i,0.0350717196883265 - 0.500038917653513i,0.496322714229578 + 0.0702332402056026i,-0.501053513999558 + 0.0146396994056337i,-0.501053513999558 + 0.0146396994056337i;-0.491929587334346 + 0.0963027818655986i,-0.237946127637339 + 0.441192231382635i,0.109120724497475 + 0.489245962860338i,0.0350717196883265 - 0.500038917653513i,0.496322714229578 + 0.0702332402056026i,-0.501053513999558 + 0.0146396994056337i,-0.501053513999558 + 0.0146396994056337i];
S1=svd(K).^2
S2=sort(abs(diag(eig(K*K','matrix'))),'descend')
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!