Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discrete bode default axis ranges #438

Closed
albheim opened this issue Jan 27, 2021 · 1 comment · Fixed by #911
Closed

Discrete bode default axis ranges #438

albheim opened this issue Jan 27, 2021 · 1 comment · Fixed by #911

Comments

@albheim
Copy link
Member

albheim commented Jan 27, 2021

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.

@olof3
Copy link
Contributor

olof3 commented Jan 28, 2021

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.

@baggepinnen baggepinnen changed the title Discrete bode default frequency range Discrete bode default axis ranges Jan 28, 2022
baggepinnen added a commit that referenced this issue Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants