Bode_plot of transfer functions has ferqueny indicated in Hz but should be rad/s?

73 views
Skip to first unread message

joe tusek

unread,
Feb 5, 2022, 1:04:10 AM2/5/22
to sympy
I'm a new user of the package and wanted to check transfer function outputs between my circuit simulator and some other control simulation package. It appears that outputs from bode_plot (sympy.physics.control.control_plots) are in rad/s for frequency, which is the natural unit for control analysis. The graph produced by bode_plot  has its frequency axis shown in Hz, but analysis and comparison to other programs suggest that it should be labelled rad/s.

Is this an error, or is there some switch somewhere in the package that sets units for outputs to Hz and degrees, rather than radians and rad/s?

I have a work around by handling graphing, just would like to use the built in functions where possible. Also would like the make use of the initial and final exponent, in the units of the graphing output.


Hanspeter Schmid

unread,
Feb 5, 2022, 12:14:35 PM2/5/22
to sympy
Can you send example code, please?

Naman Gera

unread,
Feb 5, 2022, 12:59:46 PM2/5/22
to sy...@googlegroups.com
Hi,

This is not an error, per se, as the frequency is needed to be plotted in Hz at times.
Although I suppose there should be an option to allow both Hz and rad/sec for frequency, and rad / deg for phase. It is up to the user which one to choose.
If you know how to allow both, using an optional argument, please feel free to raise a pull request.

Best,
 

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/80adfc05-80d6-49e3-a975-20b16eead1cen%40googlegroups.com.

joe tusek

unread,
Feb 6, 2022, 6:01:46 PM2/6/22
to sympy
Hi Naman,

This is actually an error in the plot. The plot is shifted by 2*pi on its frequency axis as it is has the wrong axis label.

joe tusek

unread,
Feb 6, 2022, 6:22:03 PM2/6/22
to sympy
See attached. Note that both x-axis are in Hz.
sympy bode_plot issue.pdf

Oscar Gustafsson

unread,
Feb 7, 2022, 4:11:44 AM2/7/22
to sy...@googlegroups.com
Yes, it is a bug, see this much simpler example:


from sympy.abc import s

from sympy.physics.control.lti import TransferFunction

from sympy.physics.control.control_plots import bode_plot

tf = TransferFunction(100, 100+s, s)

bode_plot(tf)


image.png

Here it is clear that the -3dB-point should be at 100 rad/s, but it is at 100 Hz.


Indeed it makes sense to have some option regarding the scale.


BR Oscar


--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.

Hanspeter Schmid

unread,
Feb 7, 2022, 5:30:39 AM2/7/22
to sympy
Confirmed; and it would also make sense to have rad and deg as options for the phase. I'll formulate an issue right away.
Reply all
Reply to author
Forward
0 new messages