# Eigenvalues in CVX

Hello,

I am new to CVX and MATLAB. I have tried to find the eigenvalues of a matrix that was constructed by using one of the decision variables. CVX doesn’t allow me to use eig() function. For example, I can’t print the eigenvalues other that the min (lambda_min) and max ones. Is there any way to use any of the eigenvalues as a right hand side of a constraint or in the objective function to be optimized?

Thanks

The eigenvalue-related functions in CVX include `lambda_max`, `lambda_min`, etc. Please read the manual, in particular the function reference.

Yes, I have read them, but I can’t find a way to find, say the second,third, etc. eigenvalues.

lambda_sum_largest (convex) and lambda_sum_smallest (concave) are available. If, for example, your matrix is stochastic, then largest eigenvalue must be 1, so 2nd largest eigenvalue equals lambda_sum_largest (with k=2) minus 1. Tricks like that may be your only chance to do what you want.

Only the first and last eigenvalues are convex and/or concave in the elements. I refer you again to the FAQ.

Thank you very much for the help. My matrix is not actually stochastic, and in order to find the 3rd smallest eigenvalue, I used: lambda_sum_largest(A, k-1) - lambda_sum_largest(A,k-2). However, this still doesn’t work. Do you have any advises on this? Thanks

Can’t be done. It’s not convex.

ivan ,i am using stochastic matrix but i am still getting errors while using lambda_max
it will be very helpful to me if you share your code
Thanks