Eigenvector without calling eigenvalues

I would like to call a eigenvector of a matirx without calling its eigenvalues inside a function. Here I attach my code. Pl somebody help me.
function [out]=integration(hami1)
[V,L]=eig(hami1); %% Some error is here showing that L is unused in my code.
u=V(:,1)/sqrt(sum(V(:,1)));
w=diff(u,phi);
f=dot(u,w);
out=1/pi*1i*int(f,phi,0,2*pi);
end

 채택된 답변

Walter Roberson
Walter Roberson 2020년 2월 1일

0 개 추천

Given your question as asked, you will need to write your own code to somehow determine eigenvectors without calculating the corresponding eigenvalues.
However what you are seeing is a warning not an error, and most people would deal with it by coding
[V,~]=eig(hami1);
which tells MATLAB to tell eig that two outputs are requested (so that it knows to return eigenvectors in the first output), but that the second output will be ignored by the code.

댓글 수: 3

AVM
AVM 2020년 2월 1일
@walter: Thanks a lot..
AVM
AVM 2020년 2월 1일
The Integration by using 'fucntion ' is faster than sciprt? Pl help me
Walter Roberson
Walter Roberson 2020년 2월 1일
integral() cannot call scripts so the relative speeds of scripts and functions is not relevant to the situation.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Vladimir Sovkov
Vladimir Sovkov 2020년 2월 1일

0 개 추천

  1. This is not an error but a warning that you do not use the eigenvalues, which influences nothing. If you want to avoid it, substitute the symbol "~" in place of "L".
  2. It looks that you use "phi" before defining it. This must be an error.
  3. Are you sure that your way of the eigenvector normalization is what you wanted? It looks quite unusual... The function "eig" is expected to produce the eigenvectors with unit algebraic norm already, at least for real symmetric matrices.

댓글 수: 7

AVM
AVM 2020년 2월 1일
@Vladimir: Thnaks a lot for reply. As you said, Matlab produces normalized eigen vector for real symmetric matrices. But here the matrix is basically a complex one. Isn't this command of normalization valid for complex matirx normalization? Pl help me to understand.
Vladimir Sovkov
Vladimir Sovkov 2020년 2월 1일
For complex self-adjoint matrices the eigenvectors are expected to be ortho-normal. Anyway, you devide you eigenvector by a square root of the sum of its component rather than by its norm. Why?
AVM
AVM 2020년 2월 1일
@Vladimir: Thanks. I would like to normalize the eigen vector of a complex matrix h. Then simply V(:,1) / norm(V(:,1)) is useful? Pl advise me.
@vladimir: Ohh.I am sorry. I have done a mistake here. It should be like this
V(:,1)./sqrt(sum(V(:,1).^2))
Vladimir Sovkov
Vladimir Sovkov 2020년 2월 1일
편집: Vladimir Sovkov 2020년 2월 1일
Both versions look correct and equivalent to each other. Though I still doubt if they are needed at all, most probably you would just divide by 1.
AVM
AVM 2020년 2월 1일
..." most probbably you would just divide by 1" . I didn't get your point. Pl help me to understand. But how I would be sure about the normalisation factor is unity?
Vladimir Sovkov
Vladimir Sovkov 2020년 2월 1일
This is problem-dependent. Sometimes it is correct, sometimes not. You can just calculate the norm of your case and see if it equals 1 or not. Maybe, you are right and this re-normalization is really needed. Anyway, it would not spoil the results, and maybe safer to keep it in the program.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

태그

질문:

AVM
2020년 2월 1일

댓글:

2020년 2월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by