Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top