?? e973.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 + -