0

这是我第一次在这里寻求帮助,希望有人回应。我希望发布图像来显示我遇到的问题,但我至少需要 10 个代表才能做到这一点。但我希望每个人都能理解我的要求。

我正在尝试创建一个操作框来绘制带有输入框的传递函数,以便我可以输入传递函数并指定 x 和 y 轴。但是情节本身并没有出现,只有轴是

但是如果我在“操纵”之外键入代码,它就可以工作。

如果您尝试在 Mathematica 上运行它,您可能会看到我遇到的问题。

我的数学代码如下。

Manipulate[tfplot,


 {{tfplot1, 0, "Transfer Function="}},


Delimiter,

 {{fmin1, 10, "fmin = "}},
 {{fmax1, 10^7, "fmax = "}},
 {{ymin1, 1, "ymin = "}},
 {{ymax1, 2*10^2, "ymax = "}},


 Delimiter,
 Row[{

   Button["Plot", tfplot = LogLogPlot[Abs[tfplot2[2*Pi*I*f] /. {tfplot2[s_] -> tfplot1}], {f, fmin1, fmax1}, PlotPoints -> 1000, PlotRange -> {{fmin1, fmax1}, {ymin1, ymax1}}, PlotLabel -> "tf Plot"], ImageSize -> 80] 
}]

 , ControlPlacement -> {Left, Left, Left, Left, Left, Left, Left, Top}]

tfplot3 = (3.333321894500285`*^6 (4.611679331492357`*^6 - 72057.48955456808` s - 4.138291871540356`*^9 s^3 - 3.889993968666704`*^9 s^4 + s^5))/(s^2 (2.606152799059127`*^18 + 4.6278171788297256`*^16 s + 1.0779994813998577`*^14 s^2 + 1.5235290577558628`*^8 s^3 + s^4))

LogLogPlot[Abs[tfplot4[2*Pi*I*f] /. {tfplot4[s_] -> tfplot3}], {f, 10, 10^7}, PlotPoints -> 1000, PlotRange -> {{10, 10^7}, {1, 2*10^2}}, PlotLabel -> "tf Plot"]

谢谢你。

蜘蛛网

4

2 回答 2

0

编辑..取2..

Manipulate[
        fplot = LogLogPlot[Abs[tfplotf /. s -> 2*Pi*I*f], {f, fmin1, fmax1}, 
           PlotPoints -> 1000, PlotRange -> {{fmin1, fmax1}, {ymin1, ymax1}}, 
           PlotLabel -> "tf Plot"],
         {{tfplotf, (3.333321894500285`*^6 (4.611679331492357`*^6 - 
                72057.48955456808` s - 4.138291871540356`*^9 s^3 - 
                3.889993968666704`*^9 s^4 + 
                s^5))/(s^2 (2.606152799059127`*^18 + 
                4.6278171788297256`*^16 s + 1.0779994813998577`*^14 s^2 + 
                1.5235290577558628`*^8 s^3 + s^4))
           , "Transfer Function="}},
    Delimiter,
        {{fmin1, 10, "fmin = "}},
        {{fmax1, 10^7, "fmax = "}},
        {{ymin1, 1, "ymin = "}},
        {{ymax1, 2*10^2, "ymax = "}},
    Delimiter,
         ControlPlacement -> {Left, Left, Left, Left, Left, Left, Left, Top}]
于 2013-10-17T18:17:51.063 回答
0

这是我在系统动力学和控制课上的一些旧代码。

Manipulate[tf = TransferFunctionModel[eq, s];

 BodePlot[tf, GridLines -> Automatic, ImageSize -> 500, 
  FrameLabel -> {{{"magnitude (db)", None}, {None, 
      "Bode plot"}}, {{"phase(deg)", None}, {"Frequency (rad/sec)", 
      None}}}, 
  ScalingFunctions -> {{"Log10", "dB"}, {"Log10", "Degree"}}, 
  PlotRange -> {{{0.1, 100}, Automatic}, {{0.1, 100}, 
     Automatic}}], {eq, (5 s)/(s^2 + 4 s + 25)}]

-布赖恩

于 2015-09-14T23:30:30.080 回答