0
$\begingroup$

I want to plot $z(F, x, \lambda)$ where I fix a few values of $F$ and $\lambda$ and see how it varies with $x$. With 2-d functions, I could vary the second parameter easily using a combination of Evaluate and Table. I'm not able to get it to run for a 3-d function: What's going wrong here?

z[F_, x_, \[Lambda]_] := (Exp[\[Lambda] (1 - F)] - 
     1) * (Exp[F*x*\[Lambda]] - 1)/(F*x*\[Lambda]);
Plot[Evaluate[
  Table[z[F, x, \[Lambda]], {{\[Lambda], {0.1, 1}}, {F, {0.5}}}]], {x, 
  0, 2}]

The error is Table::write: Tag List in {\[Lambda],{0.1}} is Protected.

$\endgroup$
  • $\begingroup$ You have an extra set of List brackets. The two iterators in your Table should not be enclosed in List brackets. Use Plot[Evaluate[ Table[z[F, x, \[Lambda]], {\[Lambda], {0.1, 1}}, {F, {0.5}}]], {x, 0, 2}, PlotLegends -> Placed[Automatic, {0.75, 0.45}]] $\endgroup$ – Bob Hanlon Oct 21 at 13:37
1
$\begingroup$
z[F_?NumericQ, x_?NumericQ, \[Lambda]_?NumericQ] :=
(Exp[\[Lambda] (1 - F)] - 1)*(Exp[F*x*\[Lambda]] - 1)/(F*x*\[Lambda]);

Plot[Evaluate[Table[z[F, x, \[Lambda]], {F, {0.5}},
{\[Lambda], {0.1, 1}}]], {x, 0, 2},AxesLabel -> {x, z},
PlotLegends -> "Expressions"]

enter image description here

$\endgroup$
0
$\begingroup$

Try this:

z[F_, x_, \[Lambda]_] := (Exp[\[Lambda] (1 - F)] - 
     1)*(Exp[F*x*\[Lambda]] - 1)/(F*x*\[Lambda]);
Manipulate[
 Plot[z[F, x, \[Lambda]], {x, 0, 2}, 
  PlotRange -> {0, 1.5}], {\[Lambda], 0.1, 1}, {F, 0.1, 0.5}]

enter image description here

Have fun!

$\endgroup$

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.