divergence
ベクトル場の発散
説明
例
ベクトル場の発散を求める
ベクトル V(x,y,z) = (x, 2y2, 3z3) に関して、ベクトル場の発散 X = (x,y,z) を計算します。
syms x y z field = [x 2*y^2 3*z^3]; vars = [x y z]; divergence(field,vars)
ans = 9*z^2 + 4*y + 1
ベクトル場の回転の発散は 0 になることを示します。
divergence(curl(field,vars),vars)
ans = 0
次のスカラー関数の勾配の発散を求めます。結果は、スカラー関数のラプラシアンになります。
syms x y z f = x^2 + y^2 + z^2; divergence(gradient(f,vars),vars)
ans = 6
電界から電荷密度を求める
微分形式のガウスの法則は、電界の発散が電荷密度に比例することを記述しています。
電界 に対する電荷密度を求めます。
syms x y ep0 E = [x^2 y^2]; rho = divergence(E,[x y])*ep0
rho =
ep0 = 1
として、-2 < x < 2
および -2 < y < 2
における電界と電荷密度を可視化します。meshgrid
を使用して、x
と y
の値におけるグリッドを作成します。subs
を使用してグリッド値を代入することによって、電界と電荷密度の値を求めます。subs
への入力として cell 配列を使用して、グリッド値 xPlot
および yPlot
を同時に、電荷密度 rho
に代入します。
rho = subs(rho,ep0,1); v = -2:0.1:2; [xPlot,yPlot] = meshgrid(v); Ex = subs(E(1),x,xPlot); Ey = subs(E(2),y,yPlot); rhoPlot = double(subs(rho,{x,y},{xPlot,yPlot}));
quiver
を使用して電界をプロットします。contour
を使用して電荷密度を重ね合わせます。等高線は電荷の値を示します。
quiver(xPlot,yPlot,Ex,Ey) hold on contour(xPlot,yPlot,rhoPlot,'ShowText','on') title('Contour Plot of Charge Density Over Electric Field') xlabel('x') ylabel('y')
入力引数
詳細
ベクトル場の発散
直交座標のベクトル V = (V1,...,Vn) に関するベクトル場の発散 X = (X1,...,Xn) は、X1,...,Xn に関する V の偏微分の和です。
バージョン履歴
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)