Create a loop to divide number and distribute half in the positive direction and half in the negative direction.

2 visualizaciones (últimos 30 días)
Take a number and divide it in half then distribute it evenly along z axis (1 meter apart). I am working on a project for school where I have to calculate e-field at a point based on multiple charges being evenly spaced along z-axis. Say I have 101 charges... I would have a 50 charges in the positive z direction and 50 charges in the negative direction as well as a charge at 0,0,0.
I believe I now how to do all of the calculating part of this project but my trouble is formulating a loop that will do what I describe above. Any help would be greatly appreciated.
  7 comentarios
Star Strider
Star Strider el 22 de Mzo. de 2016
O.K.
We’re slowly uncovering the mystery here.
Does your function calculate the current value for z as a function of the previous values of it at the previous values of z, or is it independent of the function values at previous values of z, and only dependent on the current value of z?
We could be here for hours (or days) discovering what you want to do, or you could just tell us.
I’m cool with either option.
You choose!

Iniciar sesión para comentar.

Respuestas (1)

John D'Errico
John D'Errico el 22 de Mzo. de 2016
I think you are making the problem more complex than it need be, but at the same time, you are wanting to create code too quickly to represent a system that you have not really though out how it will act. The code should come only after you understand how you will formulate the model. Once you have that understanding, the code usually is trivial to write.
For example, it sounds as if your problem is to create a set of 101 point charges, which are then used to approximate a continuous charge distribution.
In that case, then all you need to know are the locations of those charges, and the strength of those charges. Then you can compute the effect of each charge on the electric field at some other point, thus summing their individual impacts.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by