Eigenvector without calling eigenvalues
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (1)
Vladimir Sovkov
le 1 Fév 2020
0 votes
- 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".
- It looks that you use "phi" before defining it. This must be an error.
- 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 commentaires
AVM
le 1 Fév 2020
Vladimir Sovkov
le 1 Fév 2020
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
le 1 Fév 2020
AVM
le 1 Fév 2020
Vladimir Sovkov
le 1 Fév 2020
Modifié(e) : Vladimir Sovkov
le 1 Fév 2020
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
le 1 Fév 2020
Vladimir Sovkov
le 1 Fév 2020
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.
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!