能帮我画一下等量同种负电荷电场分布以及电势分布图吗?就是图解下,让我理解一下
发布网友
发布时间:2022-04-27 03:58
我来回答
共1个回答
热心网友
时间:2023-11-19 01:23
[x,y]=meshgrid(-2:0.1:2,-2:0.1:2);
z=1./sqrt((x).^2+y.^2+0.01);
[dx,dy]=gradient(z,.2,.2);
contour(x,y,z,[-12,-8,-5,-3,-1,-0.5,-0.1,0.1,0.5,1,3,5,8,12]);
hold on
quiver(x,y,dx,dy)
colormap hsv
hold off
xx=[linspace(-2,2,6),2*linspace(1,1,6),linspace(-2,2,6),-2*linspace(1,1,6)];
yy=[2*linspace(1,1,6),linspace(-2,2,6),-2*linspace(1,1,6),linspace(-2,2,6)];
streamline(x,y,dx,dy,xx,yy);