Re: How to sum the results given by loop
- From: Rune Allnor <allnor@xxxxxxxxxxxx>
- Date: Tue, 24 Jun 2008 08:55:54 -0700 (PDT)
On 24 Jun, 17:50, "Shanmukha Moturu" <Shanmukharao.Mot...@xxxxxxxxx>
wrote:
HiP = 0; <<<<<===================
i am have writen simple program as shown below
Z = input('Enter number of charge particles');
L = input('Enter the length of a plate');
H = input('Enter the distances between two plates');
X = input('Enter the value of x axis for point P');
Y = input('Enter the value of y axis for point p');
for n = 0:(Z-1)
N = (2*n)+1;
r = (N*L*1e-2)/(2*Z);
rn = sqrt((Y*1e-6)^2+(r^2));
P= P + 1/rn <<<<<===================
Vp = (1/6.672e-12)*P; <<<<<===================
end
Vp
when i run this program i found that Vp is giving nth
value of P.
But, what i am looking for is add all the P values
i mean P = (1/r1+1/r2+....+1/rn)
so that the sum of this value will be multipled by
(1/6.672e-12)
I tryed to do this by defing p2 = p2+P, but i'm unbale to
get it.
how i do this kind of problem
I've indicated some modifications which might help.
Rune
.
- References:
- How to sum the results given by loop
- From: Shanmukha Moturu
- How to sum the results given by loop
- Prev by Date: Re: MATLAB Import
- Next by Date: Re: Object dimension measurement through image processing
- Previous by thread: How to sum the results given by loop
- Next by thread: How to overlay a numerical grid over an image?
- Index(es):
Relevant Pages
|