Advertisement
Guest User

Untitled

a guest
Oct 10th, 2015
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.42 KB | None | 0 0
  1. function Gershgorin
  2.     A=[1 1 -1; 2 -2 0; 1 0 5]
  3.     GerPlot(A);
  4.     a=real(eig(A));
  5.     plot(a,zeros(length(a),1),'X');
  6.    
  7.     fplot(@(x)polyval(poly(a),x),[-4 6]);
  8.     axis([-4 6 -3 3]);
  9.  
  10. function GerPlot(A)
  11.     hold on; %fixálja a képet, arra rajzol
  12.     for i=1:size(A,1)
  13.         r=sum(abs(A(i,:)))-abs(A(i,i));
  14.         t=0:pi/20:2*pi;
  15.         x=r*cos(t)+A(i,i);
  16.         y=r*sin(t);
  17.         plot(x,y);
  18.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement