My question pertains to modifying the output of a typical Plot3D object, and overlaying a 2D shape, like a circle, on the 3D surface. Thinking of the surface as a stretchy surface, I want to put the circle on the mesh before it is "poked" and "stretched" by my function. Allow me to explain.

In general digital signal processing (DSP), it is helpful to view the complex system function of a filter in 3 dimensions, in the complex plane (x being real portion and y being imaginary portion of the dual-input [x,y] of my function), with the magnitude of the result being plotted in the z-axis.

My code is as follows:

myFunction[z_] := (0.04*z^2)/(z^2 - 1.6*z + 0.8^2)
Plot3D[Abs[myFunction[x + I y]], {x, -5, 5}, {y, -5, 5}, 
 PlotPoints -> 30]

And the results of that code are as follows:

Result of the previous code

I want to overlay a unit circle over this mesh, as it would help visualize the frequency response of this system in question. What I want looks something like this (not the same function, just an example):

Desired result

I don't know which program was used to generate the second image, but that is the result I want. The mesh is the rational system function, plotted over the complex plane, with the red circle being the unit circle.

How can I take what I already have, with my mesh plot, and overlay the unit circle on it?

Any logical or code-based help is greatly appreciated.

  • $\begingroup$ You need to use MeshFunctions. Here's an example you can use as reference: mathematica.stackexchange.com/a/8724/12 $\endgroup$
    – Szabolcs
    Feb 6, 2014 at 0:48
  • 1
    $\begingroup$ Circle of radius 3: Plot3D[Abs[myFunction[x + I y]],{x, -5, 5}, {y, -5, 5}, MeshFunctions -> {Sqrt[#1^2 + #2^2] &}, Mesh -> {{3}}] $\endgroup$
    – halirutan
    Feb 6, 2014 at 0:59

1 Answer 1


Many ways to do this, e.g. links in comments. A quick-n-dirty way is to plot your function, then get a region limited version,and then put them together, e.g:

p1 = Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}];

p2 = Plot3D[Sin[x + y^2], {x, -2, 2}, {y, -2, 2}, 
  RegionFunction -> Function[{x, y, z}, 1 <= x^2 + y^2 <= 1.2], 
  Axes -> None, MeshStyle -> Red, PlotStyle -> None];


Edit:I just read halirutan's comment, that is probably a cleaner way to do what you want.


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