Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- """
- Created on Thu Sep 19 01:25:30 2019
- @author: jzonkey
- """
- from mpl_toolkits import mplot3d
- import numpy as np
- import matplotlib.pyplot as plt
- #enables 3D axes
- fig = plt.figure()
- ax = plt.axes(projection='3d')
- #constants
- A = np.pi
- epsnot = 8.854187817e-12
- q = 1.6e-19
- #variables
- Z = np.linspace(1,.1,11)
- R = np.linspace(1,1,11)
- #expresses E as a function of Z and R
- def e_func(R,Z):
- return (q/2*A*epsnot)*(1-(Z/R))
- E = e_func(R, Z)
- #plot
- ax.plot3D(R, Z, E, 'gray')
- plt.show()
- ax.set_xlabel('R')
- ax.set_ylabel('Z')
- ax.set_zlabel('E')
- ax.set_title('Electric Field of Ring When Z<<R')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement