我正在尝试操作三个功能,并选择弹出菜单,它将显示哪些功能。我还没有放置变量(它们将代替16,25,2等)。
出于某种原因,当我运行它时,它会返回带有弹出菜单的Manipulate框,但不显示ContourPlot3D,而是显示其代码。你能找到错误吗?
Clear[x, y, z, ell, mu, du]
ell[x_, y_, z_] := x^2/16 + y^2/25 + z^2/2
mu[x_, y_, z_] := x^2/1 + y^2/2 - z^2/1
du[x_, y_, z_] := x^2/2 - y^2/4 - z^2/1
Manipulate[
ContourPlot3D[
F == 1, {x, -4, 4}, {y, -5, 5}, {z, -3, 3}], {F, {ell, mu, du}, ControlType -> PopupMenu}]
这是mathematica文档中的示例:
Manipulate[Plot[f[x], {x, 0, 2 Pi}], {f, {Sin, Cos, Tan, Cot}, ControlType -> PopupMenu}]
答案 0 :(得分:0)
f["ell"][x_, y_, z_] := x^2/16 + y^2/25 + z^2/2
f["mu"][x_, y_, z_] := x^2/1 + y^2/2 - z^2/1
f["du"][x_, y_, z_] := x^2/2 - y^2/4 - z^2/1
Manipulate[
ContourPlot3D[
f[key][x, y, z] == 1, {x, -4, 4}, {y, -5, 5}, {z, -3, 3}],
{{key,"ell"}, {"ell", "mu", "du"}, ControlType -> PopupMenu}]