⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gersch.m

📁 线性代数实验及MATLAB入门,电子工业出版社出版 陈怀琛 龚杰民合著
💻 M
字号:
function gersch(a,eigplot,color)
% The command gersch(A) will plot the Gerschgorin circles
% of A in the complex plane. The command gersch(A,eigplot) 
% will plot the Gerschgorin circles and if eigplot equals 1 it will 
% also plot the eigenvalues of A. One can specify a color for 
% the plot by including as a third argument a string specifying
% the color.  For example the command gersch(magic(5),1,'b') will 
% generate a plot of the eigenvalues and Gerschgorin circles of 
% a $5\times 5$ magic square and the plot will be drawn in blue.
if nargin==1  
   eigplot=0;
end
if eigplot
   e=eig(a);
else
   e=[];
end
c=diag(a);
r=sum(abs(a-diag(c))');
t=0:0.1:6.3;
x=real(c)*ones(1,length(t))+r'*cos(t);
y=imag(c)*ones(1,length(t))+r'*sin(t);
if nargin == 3
   plot(x',y',color,real(e),imag(e),[color,'*'])
else
   plot(x',y',real(e),imag(e),'*')
end
axis equal

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -