ControlSystems.jl
ControlSystems.jl copied to clipboard
Discrete bode default axis ranges
h = 0.1
z = tf("z", h)
sp = 2/h * (z-1)/(z+1)
sys = (1+sp)/(1+sp/10)^2
bodeplot(sys)
This does not manage to plot correctly, while it does in matlab. It seems like the last point is the villain, and the frequency for it is exactly twice the sampling frequency so I assume that has something to do with it. But I'm very bad with discrete systems so I'll leave it here for someone else to figure out.
There is a zero in -1 (actually two zeros and one pole), which corresponds to the Nyquist frequency (i.e., half the sampling frequency), so the frequency-response computation works alright.
However there are some issues with the plotting:
- The y-axis for the magnitude plot seems to be chosen extremely poorly. Perhaps because log of an almost zero number. Some heuristic to avoid this would be good. (Would probably be good to makes sure things work for imaginary-axis/unit-circle poles as well.)
- Possibly some more frequency points could be added around the pole. Perhaps there is some way to automatically sample the frequency response in an iterative manner.
If working at this I think it would make sense to start from a slightly more minimal example (e.g., two poles and a zero) since there seems to be somewhat poor numerics in the example provided.
Looking at this, I realize that it could be nice to overload getproperty
for TransferFunction{TE, SisoZpk}
for :k, :z, :p.