2
$\begingroup$

I have a 3D Plot with 3 separate functions for z in terms of x and y. I would like to convert this to a RegionPlot with the max of the three functions plotted for the variables x and y.

Essentially, this would be the top view of the 3D Plot, as whatever function is visible from the top is the highest and thus the maximum at that point.

However, I also need to add a Manipulate to this so it cannot merely be an image of the top view of the 3D Plot.

 Manipulate[ Plot3D[{0.1, Piecewise[{{α - ((2 α - 1) α)/y + ( x*α^2)/(2 y ), (1 - α) + α^2/(2 y) >= 0.35}}], Piecewise[{{α + (1 - α)^2/( 2 y), (1 - α) + (((3 α - 1) - ((Abs[1 - x]) (1 - α))) (1 - α))/( 2 y) >= 0.35}}], Piecewise[{{α - ((2 α - 1) α)/((2 - a) 2) + ((3 - 2 a - Abs[x - a] ) α^2)/( 2 y*(2 - a)^2), (1 - α) + α^2/(2 y (2 - a)) >= 0.35}}]} /. {a -> ((1 + z)/2), x -> 1} // Evaluate, {α, 0, 1}, {z, 0, 1}, AxesLabel -> Automatic, PlotRange -> Automatic, PlotStyle -> {Black, Green, Orange, Blue}], {{y, 2, Gamma}, 1, 5}] 

I would like a 2D Plot from this top view

$\endgroup$
1
  • $\begingroup$ Please add your function and code. $\endgroup$ Commented Jan 4, 2016 at 12:23

2 Answers 2

8
$\begingroup$

Here are three example functions,

f1 = Exp[-x^2 - y^2]; f2 = .5 Sin[x - y]; f3 = .002 x^2 + .07 y^2; 

And here is a top-down view of the 3D plot,

Plot3D[{f1, f2, f3}, {x, -6, 6}, {y, -4, 4}, PlotPoints -> 100, ViewCenter -> {0.5, 0.5, 0.5}, ViewPoint -> {0, 0, 4}] 

enter image description here

And here is the same view, using RegionPlot

RegionPlot[{ f1 > f2 && f1 > f3, f2 > f1 && f2 > f3, f3 > f1 && f3 > f2}, {x, -6, 6}, {y, -4, 4}, BoundaryStyle -> Dashed] 

enter image description here

Or, using your example,

Manipulate[ Module[{flist, f1, f2, f3, f4}, flist = {f1, f2, f3, f4} = Evaluate[{0.1, Piecewise[{{α - ((2 α - 1) α)/ y + (x*α^2)/(2 y), (1 - α) + α^2/(2 \ y) >= 0.35}}], Piecewise[{{α + (1 - α)^2/(2 y), (1 - α) + (((3 α - 1) - ((Abs[ 1 - x]) (1 - α))) (1 - α))/(2 y) >= \ 0.35}}], Piecewise[{{α - ((2 α - 1) α)/((2 - a) 2) + ((3 - 2 a - Abs[x - a]) α^2)/(2 y*(2 - a)^2), (1 - α) + α^2/(2 y (2 - a)) >= 0.35}}]} /. {a -> ((1 + z)/2), x -> 1}]; RegionPlot[{ f1 == Max@flist, f2 == Max@flist, f3 == Max@flist, f4 == Max@flist }, {α, 0, 1}, {z, 0, 1}, BoundaryStyle -> None , PlotPoints -> 50, PlotStyle -> {Black, Green, Orange, Blue}] ] , {{y, 2, Gamma}, 1, 5}] 

Using the PlotPoints option severely slows it down, but makes the plot smoother.

enter image description here

$\endgroup$
1
$\begingroup$

Here's my answer here applied to this question:

Manipulate[ With[{fns = {0.1, Piecewise[{{α - ((2 α - 1) α)/y + (x*α^2)/(2 y), (1 - α) + α^2/(2 y) >= 0.35}}], Piecewise[{{α + (1 - α)^2/(2 y), (1 - α) + (((3 α - 1) - ((Abs[1 - x]) (1 - α))) (1 - α))/(2 y) >= 0.35}}], Piecewise[{{α - ((2 α - 1) α)/ ((2 - a) 2) + ((3 - 2 a - Abs[x - a]) α^2)/(2 y*(2 - a)^2), (1 - α) + α^2/(2 y (2 - a)) >= 0.35}}]} /. {a -> ((1 + z)/2), x -> 1}}, ContourPlot[Ordering[fns, -1], {α, 0, 1}, {z, 0, 1}, Contours -> 1/2 + Range[Length@fns - 1], ContourShading -> {Black, Green, Orange, Blue}, MaxRecursion -> ControlActive[1, 4]] ], {{y, 2, Gamma}, 1, 5}] 

Mathematica graphics

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.