# Closed loop compensator

What does it mean if you've been told to design a compensator to ensure that the closed loop phase margin is at least 120 degrees? Isn't a compensator typically designed using the open loop transfer function? Using the matlab command allmargin() for both closed loop and open loop transfer functions of the same system yields different results!

Phase margin is indeed read from an open-loop transfer function, but the rationale behind it is to prevent the closed-loop from going unstable. As you might recall: $$T(s) = \frac{GC}{1+GC}$$ Looking at this function from a mathematical viewpoint, this function explodes when $$GC = -1$$. In bode-plot terms, $$GC = -1$$ if $$|GC| = 0dB$$ and $$\angle GC = -180 \deg$$. As most dynamical systems cross this $$0dB$$ point somewhere, one should prevent the phase is anywhere close to $$-180\deg$$. Phase margin describes the distance to $$-180\deg$$ when the magnitude crosses the $$0dB$$ line.
• if you apply a gain on the open loop tf as you explained, the point where it crosses $0dB$ shifts. Therefore you need to recompute you lead compensator with the gain included. However, it could be that because of this gain, the phase margin is already 120, which means the lead compensator is not needed. Nov 27, 2020 at 15:27
{"ft_lang_label":"__label__en","ft_lang_prob":0.9164526,"math_prob":0.9947418,"size":2346,"snap":"2023-40-2023-50","text_gpt3_token_len":543,"char_repetition_ratio":0.15200683,"word_repetition_ratio":0.18414322,"special_character_ratio":0.23699915,"punctuation_ratio":0.09234234,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9995671,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-11-30T03:24:41Z\",\"WARC-Record-ID\":\"<urn:uuid:7cfd30a9-4a7f-4ed3-863e-86dbc85df320>\",\"Content-Length\":\"160236\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:f181848a-fa83-4798-88bc-d3aacf77f3ed>\",\"WARC-Concurrent-To\":\"<urn:uuid:3603b083-8e50-4cb3-9807-25a9cc268fde>\",\"WARC-IP-Address\":\"172.64.144.30\",\"WARC-Target-URI\":\"https://engineering.stackexchange.com/questions/38833/closed-loop-compensator\",\"WARC-Payload-Digest\":\"sha1:HTMP2PFGNWEKCPUGYNF6B4CGSW2VWIND\",\"WARC-Block-Digest\":\"sha1:HBWLPTMNAGAETEBDWMX4FGVTPMUPTFVE\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-50/CC-MAIN-2023-50_segments_1700679100164.87_warc_CC-MAIN-20231130031610-20231130061610-00039.warc.gz\"}"}