سؤال

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?

هل كانت مفيدة؟

المحلول

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top