E=0;%在运行的时候首先要定义r和q数组。for i=1:nE=E+q(i)/4/pi/ep*(r-r(i))/(abs(r-r(i)))^3;endE
sum=0;for i=1:nsum=sum+q(i)/4/pi/ep*(mean_r-mean_r(i))/(abs(mean_r-mean_r(i)))^3;endE=sum;
键盘输入用input