# Discrepancy between eigenvalues and eigenvectors derived from analytical solution and matlab code.

1 Ansicht (letzte 30 Tage)
mohammad mortezaie am 23 Jul. 2021
Hello,
I have this matrix [ep+V/2 t*phi; t*conj(phi) eb-V/2].
The analytical solution for eigenvalues of this matrix is E=(eb+ep)/2+v*sqrt((eb-ep+V)/2+t^2*|phi|^2).
But matlab solution is different from this.
Can someone help me for solve this chalenge?
##### 2 KommentareKeine anzeigenKeine ausblenden
KSSV am 23 Jul. 2021
Show us the code which you tried.
mohammad mortezaie am 23 Jul. 2021
syms eb ep t V phi
H=[ep+V/2 t*phi; t*conj(phi) eb+V/2];
[E,v]=eig(H);

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Chunru am 23 Jul. 2021
Bearbeitet: Chunru am 23 Jul. 2021
First, the sign in the last element of H should be '-' rather than '+' as in your question. Second, "doc eig" command for the order of output variables. Third, make sure your analytical result is correct. Try manual simplification then. You may want to verify the symbolic expressions with some numerical values to see if they agree.
syms eb ep t V phi
H=[ep+V/2 t*phi; t*conj(phi) eb-V/2]
H = [v,d]=eig(H) % not [E, v]
v = d = ##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
mohammad mortezaie am 26 Jul. 2021
Thank you

Melden Sie sich an, um zu kommentieren.

### Weitere Antworten (1)

Steven Lord am 23 Jul. 2021
syms eb ep t V phi
H=[ep+V/2 t*phi; t*conj(phi) eb+V/2]
H = [E,v]=eig(H)
E = v = Let's check if the elements in E and v satisfy the definition of the eigenvectors and eigenvalues for H.
simplify(H*E-E*v)
ans = The elements in E and v satisfy the definition of the eigenvectors and eigenvalues for H, so they are eigenvectors and eigenvalues of H. What did you say you expected the eigenvalues to be? Are you sure you're not missing a ^2 somewhere in the first term under the radical symbol?
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
mohammad mortezaie am 26 Jul. 2021
Yes you ar right.
My analytical solution is not correct.
Thank you so much.

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Linear Algebra finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!