def plot_3d(self,ax,x1,x2,y1,y2): # give 3d plot the potential
self.x=linspace(x1,x2,self.n)
self.y=linspace(y2,y1,self.n)
self.x,self.y=meshgrid(self.x,self.y)
self.surf=ax.plot_surface(self.x,self.y,self.V, rstride=1, cstride=1, cmap=cm.coolwarm)
ax.set_xlim(x1,x2)
ax.set_ylim(y1,y2)
ax.zaxis.set_major_locator(LinearLocator(10))
ax.zaxis.set_major_formatter(FormatStrFormatter('%.01f'))
ax.set_xlabel('x (m)',fontsize=14)
ax.set_ylabel('y (m)',fontsize=14)
ax.set_zlabel('Electric potential (V)',fontsize=14)
ax.set_title('Potential near capacitor',fontsize=18)
homework_13_3.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录