ControlSystems / Numeric representation of the x-axis for bodeplot

Hello,

I want the numbers on the x-axis to be integers wenn i use “bodeplot”. For example 0 0.2 0.4, but not 210^-1 410^-1.

Thanks in advance.

Always helpful to include some code and specify the plotting package you are using, but I’m assuming you’re talking about a Plots.jl recipe for differential equations here?

If so, you should be able to pass the normal Plots kwargs to the recipe, e.g. xformatter = x -> round(Int, x) would round every x-tick to an integer, while xticks = 0:10 would directly set the x-ticks to be 0, 1, 2, …, 10.

If I interpret your plot correctly though your x-ticks are actually 0.2 to 0.9, so integers might not make a lot of sense here?

Sorry, my expression is wrong. I want to change the scale of x to so
image

in bodeplot, I don’t know how to modify it.

If you want the scale to be linear rather than logarithmic, you may pass xscale=:identity

bodeplot(h₁, scale=:identity)


You can also pass your own desired tick formatting using the xticks argument.

bodeplot(h₁, xticks=([1, 10, 100], ["a", "b", "c"]))

I think that the way to remove the scientific notation is xformatter=x->round(x;digits=2):

bodeplot(tf(1, [1, 1]), xformatter=x->round(x;digits=2))

thanks your reply. And i want to also ask, how to fill the frame around the plot?
As you can see this is only half the frame.

Which figure are you referring to? You can make use of the margin keyword to alter the margin, i.e.

plot(..., margin = 5Plots.mm)

image

I mean there is only half of the frame in this plot picture.

ah, I think the keyword is

framestyle = :box

or something like that, I’m not sure exactly which word is used, it might be :boxed etc.

In general, all these questions are answered by the documentation of Plots.jl
https://docs.juliaplots.org/stable/

Hello, I would like to modify the range of the Frequency-Phase in the Plot to increase from -300°. But I can only modify the range of the Magnitude. Is there any way to do it?

It’s a bit tricky, but I think you have to provide limits for the second plot series like this

plot(..., ylims=[(magmin, magmax) (phasemin, phasemax)]) 
1 Like

I use the bodeplot function, but there is no “ylims=[(magmin, magmax) (phasemin, phasemax)]” method.
But I found ylimsphase. The result is shown in the figure


Although the range was successfully adjusted, the numbers displayed were unsatisfactory.
In addition, the curve is not smooth, how to set the plot points?

This is not documented and also not used. You have to use the syntax I suggested above, it’s standard Plots.jl syntax for setting ylims for more than one series, similar to how you set different colors for magnitude and phase.

Provide the frequency grid to evaluate the Bode curve at.

1 Like