Mathematica Manipulate:带功能的链接按钮

时间:2014-03-27 17:05:27

标签: wolfram-mathematica

这是一个使用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函数但没有任何反应......相反,如果我直接调用

SphereSection[2,3]

然后它正确地绘制了球体的一部分......我怎么能把它们连接起来?

1 个答案:

答案 0 :(得分: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}]

如果您确实希望结果保持不变,那么按下的按钮会更难一点。 这是一种快速而肮脏的方法。请注意,您需要&#34;使用&#34;虚拟变量update,以便它作为TrackedSymbol

进入wrok
 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}]