2
$\begingroup$

How can I force an initial numeric calculation of plotting boundaries?

DP[L_, x_] := 2 π x (L - 20 Log10[x/10] - 45)
cp[Le_?NumericQ, Lc_?NumericQ] := N[10*(10^((Le - Lc)/20))]
Plot3D[DP[L, x], {L, 45, 85}, {x, cp[L, 65], cp[L, 45]}]

Plot3D::plln: Limiting value cp[L,65] in {x,cp[L,65],cp[L,45]} is not a machine-sized real number.

$\endgroup$
2
  • 1
    $\begingroup$ {L, 45, 85}, {x, cp[L, 65], cp[L, 45]} does not represent a rectangular region, which I believe that Plot3D requires. You could try specifying a rectangular region that entirely enclosed the non-rectangular one that you have here. $\endgroup$
    – bbgodfrey
    Jun 9 '17 at 10:52
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Jun 10 '17 at 13:28
4
$\begingroup$

As noted in my earlier comment, the plotting region passed to Plot3D is not a rectangular region. Instead, it is

DiscretizeRegion[ImplicitRegion[cp[L, 65] < x < cp[L, 45] && 45 < L < 85, {L, x}], 
    {{45, 85}, {cp[45, 65], cp[85, 45]}}, AspectRatio -> 1, Axes -> True, 
    AxesOrigin -> {40, 0}]

enter image description here

To obtain a 3D plot over this region, call Plot3D with a rectangular region enclosing the actual region to be plotted, and use the RegionFunction option to specify that DP is to be evaluated only in the desired region.

Plot3D[DP[L, x], {L, 45, 85}, {x, cp[45, 65], cp[85, 45]}, AxesLabel -> {L, x, "DP"}, 
    RegionFunction -> Function[{L, x, z}, cp[L, 65] < x < cp[L, 45]], PlotPoints -> 50]

enter image description here

$\endgroup$
2
  • $\begingroup$ + just to be clear - I am very glad for the help. The RegionFunction is better, and nice to get to know. $\endgroup$
    – icemover
    Jun 10 '17 at 13:12
  • $\begingroup$ My alternative was to set the function =0 when outside region I wanted: DP[L_, x_] /; x <= cp[L, 65] || x >= cp[L, 45] := 0 + Plot second function with fixed value zero to show the excluded area. $\endgroup$
    – icemover
    Jun 10 '17 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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