2

I am using Mathematica to plot the total potentials (which is the sum of an attractive potential field and a repulsive potential field) - This is related the Artificial Potential Field Method in Motion Planning, for example, see Wikipedia.

The attractive potential is "downhill" like a bowl and the repulsive potential is "uphill" ("spike")

I have attached the output for two cases (each case has two different viewing angles).

The first two figures are Case 1 and the last two are Case 2.

I prefer Case 2 (the last two figures) to which I have added to the Plot3D command:

ClippingStyle -> None

My problem is with the repulsive potential (the spike). There appears to some sort of "messy cylinder" (maroon in color) going through the entire spike. This is visible in View 2 of each case.

Is there anyway I can get rid of the cylinder by adding some options to Plot3D?

Case 1: View 1 Case 1: View 2 Case 2: View 1 Case 2: View 2

Edit Given below is the code for generating the plot.

(*Assignments*)
r = 0.5;

q = 1;

xmax = 70;
ymax = 70;

o[1, 1] = 25; o[1, 2] = 30;
A[1] = 3; B[1] = 4;

p1 = 35; p2 = 35;

(*This parameter can be changed, where g[l]>0*)
Table[g[l] = 1000, {l, 1, q}];

(*Function definitions*)
H = 1/2 ((x - p1)^2 + (y - p1)^2);

Table[EO[l] = 1/2 (((x - o[l, 1])/(A[l] + r))^2 + ((y - o[l, 1])/(B[l] + r))^2 - 1),{l, 1, q}];

(*We require the plot of the following function*)
L = H + Sum[g[l]/EO[l], {l, 1, q}];

(*The plot*)
Plot3D[L, {x, 0, xmax}, {y, 0, ymax}, ColorFunction -> "Rainbow", Mesh -> None, PlotStyle -> Directive[Opacity[5]], ClippingStyle -> None]
Jack
  • 121
  • 6

1 Answers1

4

The behavior is due to your calculations, specifically the EO[l]-table, inducing a singularity region (i.e.: the EO[l]-table is 0 for the region you see in your plot).

So, the plots are "correct", which you can verify by adding the options PlotRange->All and PlotPoints->250 (or even more).

You will have to fix those singularities (in this case resulting from deleting by zero) to get your desired smooth result.

Proof of the singularity in the E[l]-table

Plot[Evaluate[Table[EO[l],{l,1,q}]/.y->20],{x,0,40},AxesOrigin->{0,0}]

The function constructed by the table has a zero-point

Jinxed
  • 3,753
  • 10
  • 24
  • Thank you very much. I have rewritten EO[l] as a piecewise function where I set EO[l] to 1 whenever it is 0. It solved the problem. – Jack Mar 12 '15 at 12:33