Frage

I have a 2x2 matrix of [ 1 2; k 3],

and k is integer between [0,5].

I want to plot the eigenvalues of this matrix as a function of k in the range of [0,5].

How do I do that?

War es hilfreich?

Lösung

Have a look at this:

   figure();  
   hold on;      
   for k = 0:5  
        plot (ones(2, 1)*k, eig([ 1 2; k 3]), 'o');   
   end
   grid on;
   xlabel('k'), ylabel('eigenvalue');

enter image description here

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top