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

📄 e973.m

📁 matlab算法集 matlab算法集
💻 M
字号:
%-----------------------------------------------------------------------
% Example 9.7.3: Electrostatic Field 
%-----------------------------------------------------------------------

% Initialize 

   clc                  % clear scree
   clear                % clear variables
   global a b
   a = 1;               % width (m) 
   b = 1;               % length (m)  
   m = 30;              % number of x grid points 
   n = 30;              % number or y grid points 
   q = 100;             % maximum number of iterations 	
   tol = 1.0e-5;        % error tolerance 
   x = zeros (m,1);     % x axis grid points (m) 
   y = zeros (n,1);     % y axis grid points (m) 	
   U = zeros (m,n);     % electrostatic potential (V) 

% Solve Poisson equation 

   fprintf ('Example 9.7.3: Electrostatic Field\n'); 
   plotfun (0,a,0,b,'Charge Density','x','y','f(x,y)','funf973')
   [alpha,r,x,y,U] = poisson (a,b,m,n,q,tol,'funf973','');
   show ('Relaxation parameter alpha',alpha)
   show ('Number of iterations',r)
   plotxyz (x,y,U,'Electrostatic Field','x (cm)','y (cm)','u (V)')

%-----------------------------------------------------------------------


⌨️ 快捷键说明

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