1
$\begingroup$

I am trying to figure out how to graph a plane in Mathematica. This is what I am trying to graph, but nothing seems to show up in the output -- just an empty box. I've tried adjusting a lot of stuff but still nothing. Any hints? As you can probably tell i am very new to Mathematica.

L[x_, y_] = -5 x + 3 y - 4;
TanPlane = Plot3D[L[x, y], {x, -10, 10}, {y, 0, 10}, 
AxesLabel -> {x, y, z}, 
PlotRange -> {-5, 20}]
$\endgroup$
2
  • $\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
    Sep 30, 2015 at 17:08
  • $\begingroup$ Your code works fine for me as is. Are you starting with a clean kernel? Go to Evaluation > Quit Kernel > Local and select it; this will clear everything from memory. $\endgroup$ Sep 30, 2015 at 17:22

1 Answer 1

2
$\begingroup$

You probably have values assigned to one or more of x, y, z. To avoid having those substituted into your expressions, use

{x, y, z} = Range[3]; (* just to make sure code is safe *)
L[x_, y_] := -5 x + 3 y - 4
Plot3D[L[x, y], {x, -10, 10}, {y, 0, 10},
  AxesLabel -> {"x", "y", "z"},
  PlotRange -> {-5, 20}]

plot

$\endgroup$
3
  • 1
    $\begingroup$ I would add to @m_goldberg's solution: ClippingStyle->None. (Also be sure to add a semicolon after the definition of L[ ]). $\endgroup$ Sep 30, 2015 at 17:30
  • $\begingroup$ could you explain what the first line does? ive not seen that $\endgroup$ Sep 30, 2015 at 17:38
  • 1
    $\begingroup$ @StillLearningToCode. It sets x to 1, y to 2, and z to 3. It is not really needed, but it keeps me honest, making sure that I am not taking advantage of variables being unassigned. Range[3] returns {1, 2, 3}. Mathematica allows parallel assignment between lists. You can do things like swapping variables (i.e., {x, y} = {y, x}) safely in Mathematica. $\endgroup$
    – m_goldberg
    Sep 30, 2015 at 17:47

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