6
$\begingroup$

I have two surfaces which I plot them using

p0 = Plot3D[{2  x Cos[y] + 2 x Sinh[y], -2  x Cos[y] - 
    2 x Sinh[y]}, {x, -1, 1}, {y, 0, 7}, ClippingStyle -> None, 
  PlotStyle -> {Directive[Green, Opacity[0.5]], 
    Directive[Green, Opacity[0.5]]}, PlotPoints -> 25
    , Lighting -> {{"Ambient", White}}, 
  PlotRange -> {{-0.5, 0.5}, {0, 7}, {-1.0, 1.0}}]

To fill the region between these two surfaces, I use

p1 = RegionPlot3D[{2  x Cos[y] + 2 x Sinh[y] + v < 0 , 
   2  x Cos[y] + 2 x Sinh[y] - v < 0}, {x, 0, 1}, {y, 0, 7}, {v, -1, 
   1},  PlotStyle -> {Directive[Yellow, Opacity[1.25]], 
    Directive[Yellow, Opacity[1.25]]}, PlotPoints -> 25, 
    Lighting -> {{"Ambient", White}}, AspectRatio -> 1, Mesh -> None]
p2 = RegionPlot3D[{2  x Cos[y] + 2 x Sinh[y] - v > 0 , 
   2  x Cos[y] + 2 x Sinh[y] + v > 0}, {x, -1, 0}, {y, 0, 7}, {v, -1, 
   1},  PlotStyle -> {Directive[Yellow, Opacity[1.25]], 
    Directive[Yellow, Opacity[1.25]]}, PlotPoints -> 25, 
    Lighting -> {{"Ambient", White}}, AspectRatio -> 1, Mesh -> None]

Finally, I plot all of them together using

Show[p0, p1, p2, PlotRange -> {{-0.5, 0.5}, {0, 7}, {-1.0, 1.0}}, 
 Mesh -> None]

The outcome looks like enter image description here While this script fulfills my initial inquiry, I am not fully happy with the plane at x=0, which is there because of having separated regions p1,p2. Do you have a suggestion on improving this figure and removing the line at x=0?

$\endgroup$

2 Answers 2

4
$\begingroup$

I found another way to do this which only use Plot3D, the keypoint is using Filling.

Clear[g, plot1, plot2];
g[x_, y_] = 2 x Cos[y] + 2 x Sinh[y];
plot1 = Plot3D[{g[x, y], -g[x, y]}, {x, -1, 1}, {y, 0, 7}, 
   PlotRange -> {{-1, 1}, {0, 7}, {0, 1}}, PlotStyle -> Green, 
   ClippingStyle -> None, Filling -> Top, FillingStyle -> Yellow, 
   PlotPoints -> 100, MaxRecursion -> 4, MeshFunctions -> {#3 &}, 
   Lighting -> {{"Ambient", White}}];
plot2 = Plot3D[{g[x, y], -g[x, y]}, {x, -1, 1}, {y, 0, 7}, 
   PlotRange -> {{-1, 1}, {0, 7}, {-1, 0}}, PlotStyle -> Green, 
   ClippingStyle -> None, Filling -> Bottom, FillingStyle -> Yellow, 
   PlotPoints -> 100, MaxRecursion -> 4, MeshFunctions -> {#3 &}, 
   Lighting -> {{"Ambient", White}}];
Show[plot1, plot2, PlotRange -> All]

enter image description here

$\endgroup$
0
8
$\begingroup$

Maybe this.

Clear[g];
g[x_, y_] = 2 x Cos[y] + 2 x Sinh[y];
p0 = Plot3D[{g[x, y], -g[x, y]}, {x, -1, 1}, {y, 0, 7}, 
   ClippingStyle -> None, 
   PlotStyle -> {Directive[Green, Opacity[0.5]], 
     Directive[Green, Opacity[0.5]]}, PlotPoints -> 25, 
   Lighting -> {{"Ambient", White}}, 
   PlotRange -> {{-0.5, 0.5}, {0, 7}, {-1.0, 1.0}}];
plot = RegionPlot3D[{-v <= g[x, y] <= v , v <= g[x, y] <= -v}, {x, -1,
     1}, {y, 0, 7}, {v, -1, 1}, Mesh -> None, 
   PlotStyle -> Directive[Yellow, Opacity[1]], 
   Lighting -> {{"Ambient", White}}];
Show[p0, plot]

enter image description here

$\endgroup$
0

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.