danielp0
Bioengineer
- Jul 4, 2005
- 7
Hi there...
I'm trying to simulaate an elesctric field in 3D. I'm using certain assumtions... like the fact that this formula is correct
qx=k*Q(4)*(Q(1)-P(1))/(distance(Q,P)^3);
qy=k*Q(4)*(Q(2)-P(2))/(distance(Q,P)^3);
qz=k*Q(4)*(Q(3)-P(3))/(distance(Q,P)^3);
q=k*Q(4)/(distance(Q,P)^2);
e = [qx qy qz q];
this is the function that calculates the charge at each point in the 3d array.
there are muliple charges in the space, so this function is run for each point in respect to each of these charges, and then gets added up(that's another assumption I have made that just adding it up will work)
however when I run it I get slightly different results from what I really want.
I get something like this

where I would expect the charges to be in the middle of the field.
anyone know what I'm doing wrong ?
I'm trying to simulaate an elesctric field in 3D. I'm using certain assumtions... like the fact that this formula is correct
qx=k*Q(4)*(Q(1)-P(1))/(distance(Q,P)^3);
qy=k*Q(4)*(Q(2)-P(2))/(distance(Q,P)^3);
qz=k*Q(4)*(Q(3)-P(3))/(distance(Q,P)^3);
q=k*Q(4)/(distance(Q,P)^2);
e = [qx qy qz q];
this is the function that calculates the charge at each point in the 3d array.
there are muliple charges in the space, so this function is run for each point in respect to each of these charges, and then gets added up(that's another assumption I have made that just adding it up will work)
however when I run it I get slightly different results from what I really want.
I get something like this

where I would expect the charges to be in the middle of the field.
anyone know what I'm doing wrong ?