This is a follow up question to the original question here (has a solution).
I am plotting another different total potentials and for this particular case the repulsive potential is a rectangle (open at one end - please refer to the contour plot attached below).
Problem: I am getting white lines in the contour and 3D plots that seem to be coming from the sides of the rectangle. Is there a way of avoiding or getting rid off these white lines?
Given below is the code and the two plots.
(*Assignments*)
xmax = 130;
ymax = 130;
z = 3;
p[1] = 65; p[2] = 125;
a[1, 1] = 58; b[1, 1] = 130;
a[1, 2] = 58; b[1, 2] = 105;
a[2, 1] = 72; b[2, 1] = 130;
a[2, 2] = 72; b[2, 2] = 105;
a[3, 1] = 72; b[3, 1] = 130;
a[3, 2] = 58; b[3, 2] = 130;
(*Functions*)
V = 0.5*((x - p[1])^2 + (y - p[2])^2);
Table[q[k, 1] = (a[k, 2] - a[k, 1])/((a[k, 2] - a[k, 1])^2 + (b[k, 2] - b[k, 1])^2), {k, 1, z}];
Table[q[k, 2] = (b[k, 2] - b[k, 1])/((a[k, 2] - a[k, 1])^2 + (b[k, 2] - b[k, 1])^2), {k, 1, z}];
Table[l[k] = (x - a[k, 1])*q[k, 1] + (y - b[k, 1])*q[k, 2], {k, 1, z}];
Table[m[k] = Piecewise[{{0.001, l[k] < 0}, {l[k], 0 <= l[k] <= 1}, {1, l[k] > 1}}], {k, 1, z}];
Table[c[k] = a[k, 1] + m[k] (a[k, 2] - a[k, 1]), {k, 1, z}];
Table[d[k] = b[k, 1] + m[k] (b[k, 2] - b[k, 1]), {k, 1, z}];
Table[RO[k] = 0.5*((x - c[k])^2 + (y - d[k])^2), {k, 1, z}];
Table[SO[k] = Piecewise[{{0.001, RO[k] <= 0}, {RO[k], RO[k] > 0}}], {k, 1, z}];
(*Parameter: User-defined*)
Table[delta[k] = 10000, {k, 1, z}];
(*We need to plot L*)
L = V + Sum[delta[k]/SO[k], {k, 1, z}];
(*Contour plot*)
ContourPlot[L, {x, 0, xmax}, {y, 0, ymax + 1}, Contours -> 50, ColorFunction -> Function[{x, y, z}, Hue[x]]]
(*3D plot*)
Plot3D[L, {x, 0, xmax}, {y, 0, ymax + 1}, ColorFunction -> Function[{x, y, z}, Hue[z]], Mesh -> None, ClippingStyle -> {Blue, Red}]
I had a look at an earlier post (see this) but it seems that my problem is a bit different from this post.
Thanks, Jack