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[开发者_如何学Gohz, 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.
BodePlot
returns pictures with Frames
, rather than Axes
, so use FrameTicks
rather than Ticks
.
精彩评论