1、电力线图 Q1=1,Q2=-4,d=2;x=-5:0.1:5;y=-5:0.1:5;X,Y=meshgrid(x,y);R1=sqrt(X.2+(Y- d./2).2);R2=sqrt(X.2+(Y+ d./2).2);Z= Q1*(Y-d./2)./R1+Q2*(Y+d./2)./R2;C=-5:0.22:5; hold onS,h = contour(X,Y,Z,C); clabel(S); plot(0,d/2,marker,o,markersize,10,markerfacecolor,g,markeredgecolor,g);text(0,d/2,+,fontsize,20);plo
2、t(0,-d/2,marker,o,markersize,10,markerfacecolor,g,markeredgecolor,g);text(0,-d/2,-,fontsize,20);grid on,title(电力线图 );电势分布图 Q1=1,Q2=-4,d=2;x=-5:0.1:5;y=-5:0.1:5;X,Y=meshgrid(x,y);R1=sqrt(X.2+(Y- d./2).2);R2=sqrt(X.2+(Y+ d./2).2);Z= (Q1./R1)+(Q2./R2);C=-4:0.55:1; S,h = contour(X,Y,Z,C); clabel(S); hol
3、d onplot(0,d/2,marker,o,markersize,10,markerfacecolor,g,markeredgecolor,g);text(0,d/2,+,fontsize,20);plot(0,-d/2,marker,o,markersize,10,markerfacecolor,g,markeredgecolor,g);text(0,-d/2,-,fontsize,20);grid on,title(电势分布图 );电场矢量图 Q1=1,Q2=-4,d=2;x=-5:0.1:5;y=-5:0.1:5;X,Y=meshgrid(x,y);R1=sqrt(X.2+(Y- d
4、./2).2);R2=sqrt(X.2+(Y+ d./2).2);Z= (Q1./R1)+(Q2./R2);C=-4:0.55:1;Ex,Ey=gradient(-Z);E=sqrt(Ex.2+Ey.2);Ex=Ex./E,Ey=Ey./E;hold on; plot(0,d/2,marker,o,markersize,10,markerfacecolor,g,markeredgecolor,g);text(0,d/2,+,fontsize,20);plot(0,-d/2,marker,o,markersize,10,markerfacecolor,g,markeredgecolor,g);text(0,-d/2,-,fontsize,20);hold on;H=quiver(X,Y,Ex,Ey,0.5)grid on,title(电场矢量图 );