How to set latex as interpreter for the axis labels in bodeplot

12 次查看(过去 30 天)
Hi, since is possible to set latex as interpreter for the ticks and the legend I would like to do the same for bodeplot. Does somebody know how to do that? Thanks!

回答(2 个)

Star Strider
Star Strider 2016-10-28
The bodeplot function does not have that as an option.
As a work-around, I would use the Signal Processing Toolbox freqs function (for a continuous-time system, freqz for a sampled system), get the complex result by returning an output from the function, then use subplot to plot the magnitude and phase. It’s a bit more coding, and you have to create the frequency vector yourself, but will let you do whatever you want with the labels.

Walter Roberson
Walter Roberson 2016-10-29
bode() always overwrites the current figure.
In current versions (e.g., R2016b and probably since R2014b), bode() creates 3 axes in the figure. Two of the axes are immediately obvious if you examine the Children property of the current figure: those two axes are the two visible plots. The last of the axes is the upper plot (Magnitude); the second last is the lower plot (Phase).
The third axes is set to have a hidden handle and is set to have its visibility off. It is this hidden third axes that holds the title property, which is set to 'Bode Diagram'. However, in current versions, if you title() either of the other two axes, the title will automatically be transferred to the hidden axes and will be cleared from the one you set it to.
When you have the handle of one of the two axes, then in R2014b and later, you can set the axes's TickLabelInterpreter property.
If you are using a version before R2014b then there is no direct property to set the interpreter for the tick labels, and instead you will need to text() each of the labels into place individually and set the interpreter as you go. I seem to recall that there is a File Exchange Contribution that will automatically convert the older style tick labels into individual text() objects.
Setting legends for the bode plot is... interesting... in R2016b.
In R2016b, if you legend() and pass the handle of either one of the two subplot axes as the axes to operate on, then the legend will get attached only to that subplot -- so, as per what I wrote above, the passing in the last axes will affect the upper (Magnitude) subplot, and passing in the second-last axes will affect the lower (Phase) subplot. So you would think that you could legend() the two individually for whatever reason you might prefer. But that turns out not to be the case. As soon as you legend() giving the other of the two axes, the legends of the two subplots become synchronized, become the same, and a change to either one immediately changes the other to be the same!
In R2014b and later, legend() are distinct graphics object that have a property Interpreter that can be set.
I have not tested bode in R2014a or earlier to see what happens with legend. In R2014a and earlier, legend() create new (hidden) axes() and have all the properties that axes have.

类别

Help CenterFile Exchange 中查找有关 Axis Labels 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by