How to Create a 3D Plot of Electric Potential for Electromagnetism Homework?

jplcarpio
Messages
7
Reaction score
0
Hi all, I apologize in advance if this isn't the right forum to put my question.


Homework Statement


In our electromagnetism course, we were asked to give the 3D plots of the electric potential V(x/y) for the examples on our book. (We're currently using Introduction to Electrodynamics (3rd Ed.) by Griffiths.) Unfortunately, I have no background in programming though our professor assumes that all of us do. :(


Homework Equations


There were three examples:

[PLAIN]http://img820.imageshack.us/img820/9798/tograph1.jpg
[PLAIN]http://img688.imageshack.us/img688/2117/tograph2.jpg
[PLAIN]http://img694.imageshack.us/img694/1479/tograph3.jpg


The Attempt at a Solution


I've gotten a copy of Microsoft Mathematics, Scilab and Python. When I tried it on Mathematics, the program stated that the equation was too complex. As for Scilab and Python, I'm still trying to cram how-to's.

Are there other programs I can use? Or are there newbie-friendly how-to's for Scilab and Python that cover 3D plots for the three equations?

I'm already a bit desperate, I'm a few steps short of just having a friend plot it for me. :(
 
Last edited by a moderator:
Physics news on Phys.org
hmmm, I'm not sure how to do those with the summation to infinity, but if there were non of those summations, then it would be really easy with MATLAB (I assume scilab is a free alternative of MATLAB so they should function similarly)

in matlab, for example, the first term of your first example, plotting the potential I would do the following:

n = 1;
V0 = 1; a = 1; % or whatever your V0 or a are supposed to be
x = -1:0.01:1; %this specifies x from -1 to +1 in 0.01 step size
y = -1:0.01:1; %this specifies y from -1 to +1 in 0.01 step size
[xx, yy] = meshgrid(x,y);
V = 4*V0/pi*1/n*exp(-n*pi*xx/a).*sin(n*pi*yy/a);
surf(x,y,V)that will plot the case for n=1, as for n=3, n=5 etc, I'm not sure how that will work. You can do them each manually, obtaining V1, V3, V5 for n=1, n=3, n=5 respectively and add them all up, but since the summation continues until n = +inf, this probably isn't the approach...
 
wukunlin said:
hmmm, I'm not sure how to do those with the summation to infinity, but if there were non of those summations, then it would be really easy with MATLAB (I assume scilab is a free alternative of MATLAB so they should function similarly)

in matlab, for example, the first term of your first example, plotting the potential I would do the following:

n = 1;
V0 = 1; a = 1; % or whatever your V0 or a are supposed to be
x = -1:0.01:1; %this specifies x from -1 to +1 in 0.01 step size
y = -1:0.01:1; %this specifies y from -1 to +1 in 0.01 step size
[xx, yy] = meshgrid(x,y);
V = 4*V0/pi*1/n*exp(-n*pi*xx/a).*sin(n*pi*yy/a);
surf(x,y,V)


that will plot the case for n=1, as for n=3, n=5 etc, I'm not sure how that will work. You can do them each manually, obtaining V1, V3, V5 for n=1, n=3, n=5 respectively and add them all up, but since the summation continues until n = +inf, this probably isn't the approach...


One of my friends suggested something like this, however I need n= +inf. :( I tried plotting the first equation in MS Math, and it just gave me a horizontal plane which I doubt is the answer.

I'll still try out your suggestion, perhaps I can improvise a way. (But if someone out there has the magical solution, I'm wide open for suggestions. :D ) Thanks! :)
 
To solve this, I first used the units to work out that a= m* a/m, i.e. t=z/λ. This would allow you to determine the time duration within an interval section by section and then add this to the previous ones to obtain the age of the respective layer. However, this would require a constant thickness per year for each interval. However, since this is most likely not the case, my next consideration was that the age must be the integral of a 1/λ(z) function, which I cannot model.
Back
Top