2014-05-21 48 views
1

我想操縱三個功能,並選擇與彈出菜單哪些它會顯示。我還沒有放置變量(他們將在16,25,2等地方)。Mathematica:操縱ContourPlot3D與許多功能錯誤

由於某些原因,當我運行它時,它將彈出式菜單中的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}] 

這是從數學文檔中的例子:

Manipulate[Plot[f[x], {x, 0, 2 Pi}], {f, {Sin, Cos, Tan, Cot}, ControlType -> PopupMenu}] 

回答

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}] 

enter image description here