2
$\begingroup$

I don't understand why my 3D Plot is empty so was looking for some advice. I have several functions defined, one of which is used in Plot3D, as seen below.

b = Sqrt[0.75];
L = b; 
lambda = 1.11; 
pi = 3.141592653589793;

Qn[n_] := (
Sqrt[(b/lambda)^2 + (2*pi*n*b)^2];
)

V0[y_] := (   
(Exp (b/lambda)/(Exp[b/lambda] - 1))*(Exp[-y/lambda] + 
          Exp[-(L - y)/lambda] + Exp[-(y + b/2)/lambda] + 
          Exp[-(L - y + b/2)/lambda]);   
)

V[x_, y_] := (   
b*pi*(V0[y] + Sum[Cos[2*pi*i*x]*((Exp[-L*Qn[i]/(2*b)]*
      Cosh ((y - L/2)*(Qn[i]/b))/(Qn[i]*
      Sinh[Qn[i]/2]))*(1 + (-1)^(i)*Exp[-Qn[i]/2])), {i, 3}]);   
)

Plot3D[V[x, y], {x, 0, wdth}, {y, -hght, hght}]

and Mathematica just outputs an empty plot. Thanks in advance for any help, hopefully I have just missed something simple.

$\endgroup$

closed as off-topic by Henrik Schumacher, zhk, Bob Hanlon, MarcoB, m_goldberg Feb 12 at 17:42

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Henrik Schumacher, zhk, Bob Hanlon, MarcoB, m_goldberg
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ What are the values for wdth and hght? $\endgroup$ – zhk Feb 12 at 14:22
  • $\begingroup$ Minor comment: parentheses around your functions are not wrong, but they are not necessary. That is, you can write Qn[n_] :=Sqrt[(b/lambda)^2 + (2*pi*n*b)^2]; rather than Qn[n_] := (Sqrt[(b/lambda)^2 + (2*pi*n*b)^2];), for example. $\endgroup$ – Alexei Boulbitch Feb 12 at 14:39
5
$\begingroup$
wdth = 1;

hght = 1;

b = Sqrt[0.75];
L = b;
lambda = 1.11;
pi = 3.141592653589793;

Qn[n_] := (Sqrt[(b/lambda)^2 + (2*pi*n*b)^2]);

V0[y_] := ((Exp [b/lambda]/(Exp[b/lambda] - 1))*(Exp[-y/lambda] + 
      Exp[-(L - y)/lambda] + Exp[-(y + b/2)/lambda] + 
      Exp[-(L - y + b/2)/lambda]));

V[x_, y_] := (b*
    pi*(V0[y] + 
      Sum[Cos[2*pi*i*
          x]*((Exp[-L*Qn[i]/(2*b)]*
            Cosh [(y - L/2)*(Qn[i]/b)]/(Qn[i]*
               Sinh[Qn[i]/2]))*(1 + (-1)^(i)*Exp[-Qn[i]/2])), {i, 
        3}]));

Plot3D[V[x, y], {x, 0, wdth}, {y, -hght, hght}]

enter image description here

  1. Use Cos[] not Cos()
  2. Use Exp[] not Exp()
  3. Do not use ) after the semicolon use it before.
  4. The best way to debunk your code is to try give a numerical value to your functions, i.e., Qn[1], V0[1], V[1,1]
$\endgroup$

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