Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

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.

share|improve this question

marked as duplicate by Szabolcs, halirutan, rm -rf Feb 6 at 1:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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

Show[p1,p2]

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

share|improve this answer

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