{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lab 203

# Lab 203 - Lab 203 Electric Potential Name William Savastano...

This preview shows pages 1–9. Sign up to view the full content.

Lab 203: Electric Potential Name : William Savastano Object : To calculate the electric potential due to a charge and draw a contour and surface plots of the electric potential using matlab. Theory : For a given charge q the scalar electrostatic potential V at point (x,y) is given by three formulas. >> clear all >> q=1*10^-9; >> esp0=8.85*10^-12 >> k=1./(4*pi*esp0); >> k=1./(4*pi*esp0); >> x=-2.1:0.2:2.1; >> y=-2.1:0.2:2.1 >> [X,Y]=meshgrid(x,y); >> r=sqrt((X-1).^2+(Y-1).^2); >> V=k*q./r; >> [c,h] = contour(x,y,V,20); >> clabel(c,h); xlabel 'x'; ylabel 'y' >> surf(x,y,V) >> [px,py]=gradient(V,.1,.1); >> quiver(x,y,-px,-py,2) >> xlabel 'x'; ylabel 'y'

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4.98105 4.98105 4.98105 7.91108 7.91108 7.91108 7.91108 10.8411 10.8411 10.8411 13.7711 13.7711 13.7711 16.7012 16.7012 19.6312 19.6312 22.5612 22.5612 25.4913 28.4213 31.3513 34.2814 37.2114 40.1414 43.0714 46.0015 48.9315 51.8615 54.7916 57.7216 60.6516 x y -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 -4 -2 0 2 4 -4 -2 0 2 4 0 20 40 60 80
-2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 x y >> clear all >> q1=1*10^-9; >> q2=1*10^-9; >> q3=1*10^-9; >> q4=1*10^-9; >> esp0=8.85*10^-12; >> k=1./(4*pi*esp0); >> x=-2.1:0.2:2.1; >> y=-2.1:0.2:2.1; >> [X,Y]=meshgrid(x,y); >> r1=sqrt((X-1).^2+(Y-1).^2); >> r2=sqrt((X-1).^2+(Y+1).^2); >> r3=sqrt((X+1).^2+(Y+1).^2); >> r4=sqrt((X+1).^2+(Y-1).^2); >> V1=k*q1./r1; >> V2=k*q2./r2; >> V3=k*q3./r3; >> V4=k*q4./r4; >> Vtot=V1+V2+V3+V4; >> [c,h]=contour(x,y,Vtot,20); >> clabel(c,h); xlabel 'x'; ylabel 'y'; >> surf(x,y,Vtot)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
>> [px,py]=gradient(Vtot,0.1,0.1); >> quiver(x,y,-px,-py,2) >> xlabel 'x'; ylabel 'y'; 16.3022 16.3022 16.3022 16.3022 19.3061 19.3061 19.3061 19.3061 19.3061 19.3061 19.3061 19.3061 19.3061 22.31 22.31 22.31 22.31 22.31 22.31 22.31 22.31 22.31 25.3139 25.3139 25.3139 25.3139 25.3139 25.3139 25.3139 25.3139 28.3178 28.3178 28.3178 28.3178

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern