Want a random matrix which has a negative eigenvalues
Mostrar comentarios más antiguos
I want to generate an mxm (here I am showing a 3x3) matrix such that each element is an integer of some reasonable magnitude (let's say between 1 and 10) and who's eigenvalues are all negative. At first I did this to generate a random matix:
C = randi(10,3,3)
eig(C)
I reran this about 40 times and never got three negative eigenvalues. That seems odd. I could get every combination except all three being negative. Wouldn't the odds of that would be low. Is there something I don't understand about "randi" or worse, something I don't undertand about eigenvalues?
Respuesta aceptada
Más respuestas (2)
David Goodmanson
el 17 de Nov. de 2018
Editada: David Goodmanson
el 17 de Nov. de 2018
1 voto
Hi Jon,
The sum of the eigenvalues of a matrix equals the trace of the matrix. If all eigenvalues are negative their sum would be negative, but with rand(10,n,n) supplying only positive elements, the trace is positive. So you can't have all negative eigenvalues.
1 comentario
Jon Games
el 17 de Nov. de 2018
Categorías
Más información sobre Linear Algebra en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!