I've designed a Type 3 compensator and wanted to see it's bode plot on matlab.

Here is the transfer function of type 3 compensator:

enter image description here

My values are:






The code I've used on matlab is:



Here is my result:

enter image description here

As you can see here, the phase margin has a negative value but it should be positive. I can't find the problem, what's my mistake here?


1 Answer 1


Phase margin only applies to the open-loop transfer function of a closed-loop system. A compensator has a phase response, but phase margin doesn't make sense unless you add the transfer functions of the rest of the loop.

You would expect the phase of your compensator to start near -90 degrees due to the pole at origin. Once you add your compensator to the system you can then plot the open-loop response of the whole thing and see what the phase margin would be.

  • \$\begingroup\$ Thank you for the answer, is there any other way to check the stability of a compensator? \$\endgroup\$
    – Das D.
    Commented May 30, 2021 at 18:40
  • 3
    \$\begingroup\$ A compensator per se has no stability measure in isolation, it's meant to compensate the response of a control loop. So you check the stability of the whole loop with the compensator added, not the compensator itself. \$\endgroup\$
    – John D
    Commented May 30, 2021 at 19:09
  • \$\begingroup\$ Generally speaking, the compensator by itself (without any feedback) will be designed to be a stable system. Since the poles you chose are in the LHS of the s plane and since the poles at origin / on the imaginary axis ave multiplicity of one, the compensator you designed is a stable system when taken alone by itself without any feedback. There is no further checking required. Just ensure that when you are realising the pole at origin, the component tolerances or the digital realisation errors don't push it to the RHS. \$\endgroup\$
    – AJN
    Commented May 31, 2021 at 1:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.