(a) Write a MATLAB program that computes the electric field created by a solid spherical charge of density
v = 7R2 nC/m3 (R is the radial distance, i.e., the range, in spherical coordinates), and a radius 0.2m, at a location (x=0, y=3m, z=0) as shown. The medium outside of the sphere is air. The charge is centered at the origin of the coordinate system. Write your own numerical integration code (to solve the integral in eq. 4.21a in the textbook) that uses
summation loops corresponding to each of the 3 spherical coordinates. Use at least 100 steps per coordinate. Provide a clear “print screen” printout, which contains: the entire .m file, its execution and the result of the execution.
(b) Verify the result of your computation in (a) by using Gauss’ law to solve the same problem.


0 comments