Using MATLAB, I fixed the potential in a region inside a rectangular plate (100 V) and in the border (50 V). I got the following result of the potential along the plate:

enter image description here

I can't find an intuitive explanation why the potential would decrease to values below the least potential (50 V).

The figure above is wrong because the number of iterations was not enough (200). Here is the same plate with 1000 iterations:

enter image description here

  • 2
    $\begingroup$ What math/physical laws did you feed into MATLAB? $\endgroup$
    – Gert
    Commented Jul 22, 2016 at 0:34
  • 1
    $\begingroup$ I used the Finite Difference Method, iterating over the matrix of potentials 200 times and updating v(i,j) = 0.25 * ( v(i+1,j) + v(i-1,j) + v(i,j+1) + v(i,j-1) ). $\endgroup$ Commented Jul 22, 2016 at 0:39
  • 1
    $\begingroup$ This method is fun to try when you learn the elegant average-over-boundary property of Laplace's equation -I'm betting you'll find a large number of people on this site who tried it before they began formal training, But it is abominably slow - as you've found, convergence is snail paced. This is therefore a great question for this site. $\endgroup$ Commented Jul 22, 2016 at 2:41

1 Answer 1


If you're trying to simulate a 2D solution of the Laplace equation (which is the only unambiguous reading of your post as currently stated; if that's not what you're doing then you should clarify your question with exactly what it is you're doing and how), then your code is wrong.

The reason is that your results don't obey the maximum principle: a harmonic function cannot have any local maxima or minima except at the boundaries.

With things as they are, I would put my money on there being a bug in your code. (Note, however, that this is not really the place to ask people to help you debug it. Depending on how you phrase it, Computational Science may be the place or not.)

  • $\begingroup$ Thank you!!! The number of iterations (200) was not enough. I ran it using 1000 iterations and I got to the expected result!! $\endgroup$ Commented Jul 22, 2016 at 1:32
  • $\begingroup$ @Vinícius well, there you go. Take that as a lesson to always test your numerical results for convergence. $\endgroup$ Commented Jul 22, 2016 at 2:01
  • $\begingroup$ (And also, what kind of boundary condition were you using that the potential went below the boundary condition? Just a constant at zero? That'd be straight-up asking for slow convergence, if you're going to use a constant at least set it to 75V or something.) $\endgroup$ Commented Jul 22, 2016 at 2:04
  • $\begingroup$ I was using zero. I set it to 75V and the expected result was achieved with less than 200 iterations, awesome!! $\endgroup$ Commented Jul 22, 2016 at 2:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.