This question already has an answer here:

I am interested in computing the derivatives of the eigenvalues of a certain $n\times n$ Hermitian matrix $M(t)$. I know I can do this easily since I know the exact expression for $\dot{M}$, and the resulting matrix is time independent. The usual argument is that $\dot{\lambda_i}(t)= \langle v_i(t),\dot{M}v_i(t) \rangle$, where $v_i(t)$ are the instantaneous eigenvectors of M. The problem that I am running into is that when computing the $v_i(t)$ numerically, the Eigenvector command will rearrange the order of the eigenvectors as $t$ changes (most likely because two eigenvalues approach one another in value and cross). My idea would be to try to order the eigenvectors by minimizing their distance to a reference vector. Does anyone know if it's possible to implement this?


marked as duplicate by Roman, Community Jun 20 at 20:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.