# Unexpected behaviour of RegionFunction in 3D plot

I am trying to plot a function defined in a specific parameter space using the RegionFunction option in Plot3D.

So, this is how I define the region where I want to plot my function

Vld[l_, c_] = If[0 < Q3A < 1 && 1 > A > 0 && 1 > B > 0, True,  False]


Then, I do

A = 1/2; B = 1/2; H = 2/10; G = 1/2;


Followed by

Plot1 =
Plot3D[Q3A, {L, 00, 1}, {c, 0.0, 1},
AxesLabel -> {"L", "c", "PlatformUtil"},
RegionFunction -> Function[{x, y}, Vld[x, y]],
PlotRange -> All,
ImageSize -> Large]


When I look at the plot, I should not see any value above 1, but I see a few spikes in the corner. Am I doing something wrong in the way I am using the region function?

UPDATE

Here is a variation of the same problem which is a little trickier to fix

Plot1 =
Plot3D[PU, {L, 00, 1}, {c, 0.0, 1},
AxesLabel -> {"L", "c", "PlatformUtil"},
RegionFunction -> Function[{x, y}, Vld[x, y]],
PlotRange -> All,
ImageSize -> Large]


Where PU is also a function of the parameters and Q3A.

When I try Reduce[Vld[L, c] && PU > 2]

I get False

When I look at the plot, I should not see any value above 1, but I see a few spikes in the corner.

[ 1

Am I doing something wrong in the way I am using the region function?

• does this give what you need ClearAll[Vld,Q3A ]; Vld[l_, c_, z_] := If[0 < z < 1 && 1 > A > 0 && 1 > B > 0, True, False]; A = 1/2; B = 1/2; H = 2/10; G = 1/2; Q3A = 10 (L c); Plot1 = Plot3D[Q3A, {L, 0, 1}, {c, 0.0, 1}, RegionFunction -> Function[{x, y, z}, Vld[x, y, z]]]? – kglr Sep 5 '18 at 16:28
• Thank you for answering. I see that you have added 0 < z < 1 && to the condition. Actually what I intend to plot is a function of Q3A which is messy to paste here. I debugged it down to Q3A exceeding the limit. Is there a way to get around this problem where I can't specify a condition on Q3A? – SreeVathsan Sep 5 '18 at 16:39
• SreeVathsan, z in the condition 0<z<1 stands for the the value in the third-dimension (the value the first argument of Plot3D, i.e. Q3A takes). – kglr Sep 5 '18 at 16:49
• Thank you kglr. I got it. What I am trying to do it plot another function of Q3A. There, I cannot do this because the third argument is no longer Q3A. – SreeVathsan Sep 5 '18 at 17:06