Can I plot eigenvalues corresponding to certain eigenvectors?

4 ビュー (過去 30 日間)
Pawel Rochowski
Pawel Rochowski 2016 年 6 月 22 日
コメント済み: Pawel Rochowski 2016 年 6 月 22 日
Hello everyone!
I've got a matrix 4x4 with with some kind of functions as a matrix elements. I would like to plot eigenvalues corresponding to certain eigenvector, in my case (-1 0 0 1). My idea is something like that (part of the code):
[vec,val]=eig(matrix);
for n=1:4
c=vec(:,n);
if c(1)+c(4)==0 && c(1)~=0 && c(4)~=0
y=loglog(w,(val(n,n));
hold on;
end
end
It seems that loop with element 'c=vec(:,n)' is not sufficient for the case, as Matlab draws only a few points (for sure too few). What I would like to get: first loop (n=1:4) takes each of eigenvector of the system, and then (second loop) draws only those eigenvalues, which corresponds to the statements given as in the code above. Any idea how to fix my code?
Any help appreciated!

採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2016 年 6 月 22 日
Well first you have to remember that the eigenvectors doesn't necessarily exactly match your desired one, so you'll have to be prepared to save away that deviation too.
Perhaps something along:
[vec,val]=eig(matrix);
target_vec = [-1 0 0 1];
[mostParallel,idxBest] = max(abs(vec*target_vec'));
Lambda_mostParallel = val(idxBest,idxBest);
HTH
  1 件のコメント
Pawel Rochowski
Pawel Rochowski 2016 年 6 月 22 日
Thank you for the answer. I checked the system - as you pointed out, the values of eigenvectors elements vary a little bit. So that was my problem. Your method improved my calculus, but still I was getting problems, since other vectors are 'more' parallel to target vector than [-1 0 0 1] (by 'more; I understand the first found vector with elements [-a 0 0 b] a>0 b>0) :) So I decided to use an eigenvectors matrix property which I did not mentioned before, that absolute values of vector elements for which I want to plot eigenvalues are the biggest one in rows 1 and 4. Nevertheless, thanks for response and time!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by