Skip to content

margin() gives incorrect phase margin for system with negative margin #961

@hdodiaz

Description

@hdodiaz

Negative phase margins are displayed as positive for systems with negative phase margin in function ´margin()´. Function ´marginplot()´gives correct (negative) value.
Example:
P=tf(1,[5, 10.25, 6.25, 1])
w_180, gm, w_c, pm = margin(50P)
results in gm = 35.08

For the same system, marginplot(50P)'s result is
Pm: [-35.08]

I believe the bug occurs in line 509 of file analysis.jl that computes gm as
abs.(pm)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions