Want a random matrix which has a negative eigenvalues
Mostra commenti meno recenti
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?
Risposta accettata
Più risposte (2)
David Goodmanson
il 17 Nov 2018
Modificato: David Goodmanson
il 17 Nov 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 Commento
Jon Games
il 17 Nov 2018
Categorie
Scopri di più su Linear Algebra in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!