如何设置BodePlot上的Ticks?
我似乎无法更改 Mathematica 8 中 BodePlot 上的刻度。
Clear[z]
hz = z/(z - 0.4) (*make up some transfer function *)
ts = 1;
tf = TransferFunctionModel[hz, z, SamplingPeriod -> ts];
scale = {{"Linear", "dB"}, Automatic};
BodePlot[tf,
PlotRange -> Automatic,
ImageSize -> 300,
ScalingFunctions -> scale,
Ticks -> {{{0, Pi/4, Pi/2, 3/4 Pi, Pi}, Automatic}, Automatic}
]
根据文档,所有绘图选项都可用于 BodePlot。
请注意,BodePlot 的 Ticks 格式提供为 2 个列表,而不是普通图的一个,因为生成了 2 个图。在上面,我试图更改第一个图(幅度图)的 x 轴刻度。
问题是:如何更改 BodePlot 上的刻度?我在上面的调用中犯了错误吗?
谢谢
编辑1
现在使用FrameTicks,我发现了一个非常奇怪的行为。如果我对框架右侧或顶部的任何刻度使用“自动”,我会在控制台中收到内核错误。这是一个示例
Clear[z]
hz = z/(z - 0.4)
tf = TransferFunctionModel[hz, z, SamplingPeriod -> 1];
BodePlot[tf,
FrameTicks ->
{
{{Automatic, Automatic}, {Automatic, None}},
{{Automatic, None}, {Automatic, None}}
}
]
上面在控制台上给出了内核错误消息。奇怪的是,如果我再次运行相同的命令,我不会在控制台上再次看到错误。
将上面的内容更改为以下内容,错误就会消失:
Clear[z]
hz = z/(z - 0.4)
tf = TransferFunctionModel[hz, z, SamplingPeriod -> 1];
BodePlot[tf,
FrameTicks ->
{
{{Automatic, None}, {Automatic, None}},
{{Automatic, None}, {Automatic, None}}
}
]
当我使用它时,我不会收到错误:
Clear[z]
hz = z/(z - 0.4)
tf = TransferFunctionModel[hz, z, SamplingPeriod -> 1];
BodePlot[tf,
FrameTicks -> {{Automatic, Automatic}, {Automatic, Automatic}}
]
因此,似乎在 FrameTicks 的右侧和顶部使用“自动”而不是“无”会导致 BodePlot 出现问题。我认为在有疑问时使用自动值是一个安全的值,但在这种情况下并非如此。
I can't seem to be able to change the Ticks on BodePlot in Mathematica 8.
Clear[z]
hz = z/(z - 0.4) (*make up some transfer function *)
ts = 1;
tf = TransferFunctionModel[hz, z, SamplingPeriod -> ts];
scale = {{"Linear", "dB"}, Automatic};
BodePlot[tf,
PlotRange -> Automatic,
ImageSize -> 300,
ScalingFunctions -> scale,
Ticks -> {{{0, Pi/4, Pi/2, 3/4 Pi, Pi}, Automatic}, Automatic}
]
According to documentation, all Plot options can be used for BodePlot.
Notice the format for Ticks for BodePlot is supplied as 2 lists not one as normal plots, as there are 2 plots generated. In the above, I am trying to change the x-axis ticks for the first plot (the magnitude plot).
The question is: How to change Ticks on BodePlot? Am I making an error in the above call?
thanks
EDIT 1
Now using FrameTicks, and I found a really strange behavior. If I use Automatic for any of the ticks for the right or top sides of the frame, I get kernel errors in the console. Here is an example
Clear[z]
hz = z/(z - 0.4)
tf = TransferFunctionModel[hz, z, SamplingPeriod -> 1];
BodePlot[tf,
FrameTicks ->
{
{{Automatic, Automatic}, {Automatic, None}},
{{Automatic, None}, {Automatic, None}}
}
]
The above gives kernel error messages on the console. The strange thing, if I run the same command again, I do not see the errors again on the console.
Change the above to the following, and the errors go away:
Clear[z]
hz = z/(z - 0.4)
tf = TransferFunctionModel[hz, z, SamplingPeriod -> 1];
BodePlot[tf,
FrameTicks ->
{
{{Automatic, None}, {Automatic, None}},
{{Automatic, None}, {Automatic, None}}
}
]
And when I use this, I do not get errors:
Clear[z]
hz = z/(z - 0.4)
tf = TransferFunctionModel[hz, z, SamplingPeriod -> 1];
BodePlot[tf,
FrameTicks -> {{Automatic, Automatic}, {Automatic, Automatic}}
]
So, it seems using Automatic instead of None for the right side and the top side in FrameTicks causes a problem for BodePlot. I thought automatic was a safe value to use when in doubt, but not in this case.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
BodePlot
返回带有Frames
的图片,而不是Axes
,因此使用FrameTicks
而不是Ticks
>。BodePlot
returns pictures withFrames
, rather thanAxes
, so useFrameTicks
rather thanTicks
.