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

Phase plot in marginplot does not show dashed line at -180 degrees. #771

Open
lucasmsoares96 opened this issue Nov 14, 2022 · 1 comment

Comments

@lucasmsoares96
Copy link

Version: ControlSystems v1.5.1

using ControlSystems
using Plots
y2 = tf(
	[1],
	[1,13,40,0]
)
marginplot(y2,
	xticks=exp10.(-2:0.5:4),
)

the output of the code above is as follows:

Captura de tela de 2022-11-14 16-44-31

In the magnitude graph, a dashed line at 0 is shown. In the phase graph, a dashed line at -180 degrees is not shown.

baggepinnen added a commit that referenced this issue Feb 1, 2023
phase guides should be shown at pm 180 deg, not at 0.

fixes #771
baggepinnen added a commit that referenced this issue Feb 1, 2023
phase guides should be shown at pm 180 deg, not at 0.

fixes #771
@baggepinnen
Copy link
Member

Hello and thanks for the report! I think that the problem here comes from the fact that the system is believed to have infinite phase margin when considering only the frequencies over which the plot is drawn, the gain curve never crosses 1. If the gain of the system is increased, you get the phase guide at -180.

marginplot(10y2,
               xticks=exp10.(-2:0.5:4),
       )

image

There are thus two problems here

  1. The phase margin is incorrectly computed due to the poorly chosen default frequency axis
  2. No phase guide is shown unless there is a phase margin to draw

Providing a better frequency vector also resolves the problem

julia> w = exp10.(LinRange(-2, 2, 200));

julia> marginplot(y2, w,
               xticks=exp10.(-2:0.5:4),
       )

image

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

No branches or pull requests

2 participants