4

Here is the code for the 2D square well potential:

v[x_, y_] := Piecewise[{{1, 58 < Abs[x]}, {1, 58 < Abs[y]}}]; Plot3D[v[x, y], {x, -70, 70}, {y, -70, 70}]

Is Piecewise the right function to use? How do I put a standalone wall barrier inside this square well potential?

Michael B. Heaney
  • 1,637
  • 12
  • 18

1 Answers1

4
Plot3D[1 - HeavisidePi[x/116, y/116], 
    {x, -70, 70}, {y, -70, 70},
    PlotPoints -> 100, Exclusions -> None]

enter image description here


Plot3D[1 - HeavisidePi[x/116, y/116] + 
       HeavisidePi[x/2, y/116],
 {x, -70, 70}, {y, -70, 70},
 Mesh -> 50,
 PlotPoints -> 100, Exclusions -> None]

enter image description here

David G. Stork
  • 41,180
  • 3
  • 34
  • 96