Computational Electromagnetics: Charge on Wire

Imagine that you transfer some charge on a wire and you wish to find how that charge is distributed on it (Spoiler Alter; it’s not distributed uniformly along the length of the wire). How would you do that?

First of all, you need to know the potential (or voltage) that it creates. In the real world, this is the cause of the charge transfer (for example, a battery is characterized by its ability to create a voltage difference between its terminals). In our case, let’s assume the wire is alone in space and has a charge distribution such that it produces a voltage difference V between the wire and infinity. In other words, we need to spend V joules of energy if we were to transfer a point charge from infinity to the wire’s surface.

We now wish to find the potential created by this charged wire in an arbitrary point in space. This is given by the following known formula from electrostatics

(1) V(x,y,z) = \frac{1}{4 \pi \epsilon_0} \int \frac{\rho (x',y',z')}{R} dv'

where R is the distance between the charge density \rho and the observation point given by the following equation

(2) R=\sqrt{(x-x')^2 + (y-y')^2 + (z-z')^2}

The integration takes place everywhere in space where the charge density is not zero. In other words, if one wishes to find the charge distribution on the wire, equation (1) must be solved. However, this is not an easy task, since \rho is the integrand. An alternative is to seek a numerical solution.

The wire is made out of perfectly conducting metal so it can be regarding as equipotential. Now, let’s assume that its radius is very thin and the charge is located on a line on its surface. The observation point will be the axis of the wire, where we know the potential. In addition, suppose we can write \rho as

(3) \rho(x) = \sum_{n=1}^{N} a_n g_n (x)

where a_n are arbitrary coefficients that need to be determined and g_n (x) is given by the following formula

(4) g_n (x) = 1, x \in [(n-1) \frac{L}{N}, n \frac{L}{N}]

where L is the length of the wire and [/math] N [/math] is the number of segments that we have partitioned the wire.

The careful reader can immediately see the meaning behind equations (3) and (4). The wire has been separated in N pieces and a_k gives the charge distribution (in Coulombs per meter) for the k-th segment.

We can align the wire to the x-axis, so equation (2) becomes

(5) R=\sqrt{(x-x')^2 + a^2}

where a is the radius of the wire.

After all these changes equation (1) becomes

(6) V(x) = \frac{1}{4 \pi \epsilon_0} \sum_{n=1}^{N} a_n \int_{(n-1) \frac{L}{N}}^{n \frac{L}{N}} \frac{1}{\sqrt{(x-x')^2 + a^2}} dx'

This is a linear equation with N unknowns, but for a particular observation point. We can construct an invertible matrix, if we take into account N-1 additional observation points, that need to be linearly independent, so they cannot belong to the same segment.

A MATLAB function was written to demonstrate the feasibility of this technique, also known as Method of Moments. It accepts as inputs the length of the wire, the number of segments, the voltage of the wire and its radius. The output is a plot depicting the charge density of the wire along its length.

function charge_on_wire(length, number_of_segments, voltage, wire_radius)


for m=1:1:nos
for k=1:1:nos
fun = @(x) 1./sqrt(((l./(2.*nos))+(l.*(m-1)./nos)-x).^2+wr.*wr);



for i=0:l/nos:l*(1-1/nos)


The plot for a wire of unit length, unit voltage, radius of 1 millimeter and partitioned in 50 segments can be seen below. It confirms the widely known rule of thumb, that charge tends to get concentrated at the edges of a structure.

Leave a Reply

Your email address will not be published. Required fields are marked *