samedi 3 mars 2018

Generate random matrix with eigenvalues

I am doing the following to generate random matrices with eigenvalues in a specific range:

function mat = randEig(dim, rReal)

    D=diff(rReal).*rand(dim,1)+rReal(1);
    P=rand(dim);
    mat=P*diag(D)/P;

end

But I also want to be able to generate random real matrices with complex (conjugate) eigenvalues. How would one do that? The similarity transformation trick would return complex matrices.




Aucun commentaire:

Enregistrer un commentaire