I've been trying to code up an infinite waveguide. To do so, I need to build an open box and overlay several trigonometric functions onto the same set of axes. As someone fairly new to Mathematica, I figured combining the "Graphics3D"and "Plot" functions could work. Is this feasible, or would you suggest an alternative?

The final product should look something like this: TE_{10} Waveguide


  • $\begingroup$ Is there any chance that you might be able to find a fairly simple image somewhere on the web that looks similar to what you would like to construct? And then append that image onto your question? $\endgroup$ – Bill Aug 21 '18 at 21:00
  • $\begingroup$ Thanks, Bill. Good point $\endgroup$ – Anna Chrysostomou Aug 21 '18 at 21:38
  • 1
    $\begingroup$ Try tweaking this Plot3D[Sin[x] Cos[y], {x,0,10 Pi}, {y,-Pi/2,Pi/2}, ColorFunction-> Function[{x,y,z}, Hue[-z]], PlotPoints->200, AspectRatio->1/2] $\endgroup$ – Bill Aug 21 '18 at 22:29
  • $\begingroup$ You can combine multiple graphics into a single image using Show $\endgroup$ – Bill Aug 21 '18 at 22:36

Perhaps this will get you started. I'm not sure how faithfully you would like the image reproduced. For the waveguide, you can use FaceForm to make one side translucent/transparent. If the frame as shown is important, you'll have to add more polygons to the graphics. For a thin edge, you can use EdgeForm, but if you make the edges thick, they don't match up at the corners of the box.

 Plot3D[Cos[x] Sin[2 y], {x, -π/2, π/2}, {y, 0, 9 π/2},
  ColorFunction -> (ColorData["Rainbow"][#3] &),
  MaxRecursion -> 3, Mesh -> None,
  BoxRatios -> Automatic, Boxed -> False, Axes -> False],
   Tuples[N@{{-π/2, π/2}, {0.3, (9 π)/2 - 0.3}, {-1, 1}}],
     Directive[RGBColor[0.7, 0.6, 0.2], Opacity[0.2]],
     Directive[RGBColor[0.7, 0.6, 0.2], Opacity[1]]],
    Polygon[{{1, 2, 4, 3}, {7, 8, 6, 5}, {1, 3, 7, 5}, {2, 6, 8, 4}}]

Mathematica graphics


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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