So I am very new to Mathematica and I'm using version 9. I need to plot a function $f(x,y)$ such that $f(x,y)$ is equal to $y^2$ when $x > y$ and equal to $10 \sin(x)$ when $x < y$. I want two contour plots, one in 2D and one in 3D. So far, I have plotted the 2D version without a problem in the following way:
f3[x_, y_, z_] := If[x > y, y^2, If[x < y, 10*Sin[x]]];
ContourPlot[f3[x, y, z], {x, -5, 5}, {y, -5, 5}, Contours -> 20, ColorFunction -> "Rainbow", PlotRangePadding -> None]
Attempting to plot the 3D version, I tried entering this:
ContourPlot3D[f3[x, y, z], {x, -5, 5}, {y, -5, 5}, {z, -5, 20}]
and sadly received this monstrosity:
Any idea why? Any and all help would be greatly appreciated, I'm hoping it's a simple fix considering I've only been using the software for a few days.
EDIT: In response to some of the comments, this is the example that was provided (e.g. what it's supposed to look like):
I understand that my function depends only on x and y, I only added the z to make the plot work. To clarify my question, how do I make it look like the second plot? Thanks for the help so far by the way
Plot3D
? Your function isn't a function of z at all.. $\endgroup$contours->50
toContourPlot3D
it should be more apparent what you are plotting..(slow) $\endgroup$f[x_, y_]:=...
andPlot3D[f[x, y], {x,...}, {y,...}]
and so forth. $\endgroup$