2014-03-27 17 views
0

這裏使用Mathematica創建一個簡單的操縱菜單:數學操縱:與函數鏈接按鈕

SphereSection[d_, h_] := 
    RegionPlot3D[(x^2/d) + (y^2/d) + (z^2/h) <= 1, 
    {x, -5, 5}, {y, -5, 5}, {z, 0, 5}, 
    AxesLabel->{"Lunghezza Km" , "Larghezza Km", "Profondità Km"}, 
    PlotLabel->Style[Framed["Semisfera di riferimento"],25]] 

Manipulate[ 
    {diameter,highness,estimatedPorosity,waterSaturation,netOnGross,bg},    
    {diameter, 0, 200},{highness,0,200},{estimatedPorosity,0,100}, 
    {waterSaturation, 0, 100}, {netOnGross, 0, 100}, {bg, 0, 1}, 
    Button["GO", SphereSection[diameter, highness]]] 

當我設置的直徑和高度與圖形菜單,我希望我以後的功能SphereSection被稱爲VE按下按鈕,但沒有任何反應......不是,如果我直接打電話

SphereSection[2,3] 

然後正確繪製球體的部分...我怎樣才能把兩者聯繫起來?

回答

1

這是做你想做的嗎?

Manipulate[SphereSection[diameter, highness], 
     {{diameter, 100}, 0, 200}, 
     {{highness, 100}, 0, 200}, 
     {estimatedPorosity, 0, 100}, 
     {waterSaturation, 0, 100}, 
     {netOnGross, 0, 100}, 
     {bg, 0, 1}] 

如果您確實希望結果持續,直到您按下一個稍微困難的按鈕。 這是快速和骯髒的方法。請注意,您需要「使用」虛擬變量update以使其生成TrackedSymbol

Manipulate[update; SphereSection[diameter, highness], 
    {{diameter, 100}, 0, 200}, 
    {{highness, 100}, 0, 200}, 
    {estimatedPorosity, 0, 100}, 
    {waterSaturation, 0, 100}, 
    {netOnGross, 0, 100}, 
    {bg, 0, 1}, {update, {True, False}}, TrackedSymbols :> {update}]