 we are discussing about the frequency domain representation of LQR control systems. So, when you are discussing this one last class we just recall that our basic Riccati equation algebraic Riccati equation which is referred to equation number 3 in our earlier lectures and that algebraic Riccati equation we added PS term and subtracted from this one if you add and subtract then this is a PSI minus PSAP so it is a cancelled that one now this is PA minus PA and this is minus that this is a you see this one S1 minus PA so that that will be minus here here should be a transpose because our basic equation is a transpose here is a transpose agree then P B R inverse B transpose minus Q because our Riccati equation is a transpose P plus PA minus P B R inverse B transpose minus Q so both side I multiplied by minus it does not matter so we got it this one so now what we did it this one so this will be our transpose agree then premultipated both premultipated and postmultipated by the factor this one and this should be a transpose agree both side I am premultipated by and postmultipated by this one if I premultipated by B transpose minus SI minus A transpose whole inverse then we have it is a A transpose agree and postmultipated by that one both sides so here also will be A transpose so after multiplying by both side by P transpose we got it this expression so if you see this expression P transpose this SI minus A transpose this SI minus this and this is postmultipated by this so this quantity and this quantity will be identity matrix so P B so here only the correction is there A transpose then it is a this term you see SI minus A SI minus this if you push it in this in this side so this and this will be our A transpose this as A transpose so this this will be identity matrix so B transpose P multiplied by SI minus A whole inverse B so B transpose P SI minus A whole inverse B then we have a this term you see both side I am multiplying by this one so this term as it is premultipated by this postmultipated by this so here will be a transpose is there and postmultipated is this one this is a left hand side and right hand side since we have multiplied by Q premultipated by this one postmultipated by this one so this transpose is missing so this is that now what we did it from equation 7 we have we know the our controller gain is nothing but a R inverse B transpose P agree so that if we premultipated by R so K R is B transpose P so in this equation whenever we are getting B transpose P we will replace by R K if you replace by this one the right hand side of this equation that B transpose SI minus this is transpose this transpose here Q SI minus this and right hand side of this one P B P B is replaced by what is called by K transpose R actually K transpose R transpose since R is a symmetric matrix so R transpose is equal to R so this will be a this one and for P B I am writing is K transpose R K transpose R then B transpose P I am replacing by R K so this is SI minus this so this will be a transpose that one agree so that because this is the transpose here so if you do this one then after that we proceed like this way so last class we have come up to this point then we proceed like this way so see the left hand side what we can write it this portion what we are writing next so the left hand side we can write B transpose I am denoting by this one this by Phi S Phi S that SI minus A whole inverse is Phi S so then I can write it B transpose then Phi minus S whole transpose see this one S is replaced by minus S so it will be Phi minus S then whole transpose in place of this is our Phi S then if you take the whole transpose that will be SI minus A transpose then your K transpose R then K transpose R the next term is R K as it is you see R K as it is so this term I will replace by Phi S so this will be R K as it is then I am replacing this is Phi S that means SI minus A whole inverse is a Phi S into B so this quantity and this quantity is the left hand side here you see I have just written this part this part but this parts also left it in the left hand side so that I missed it here so I will write it this is B transpose then SI minus A transpose whole inverse then P B P B is what K transpose R K transpose R the P B this is the left hand side we have this term plus this term and this term is replaced by this one replacing P B and this term is replacing by this one and this also there B transpose this as it is P B is now replaced by K transpose R then we have a R inverse R inverse then B transpose P is a R K into this term into this term again so this is SI minus A whole inverse so now the third term is coming here if you see it is a B transpose Phi minus S transpose then K transpose then your K transpose K K transpose R K K transpose you see this is as it is this is identity matrix this is identity matrix so K transpose R K K transpose R K plus into Phi K Phi S agree plus so this we have written this then so that this plus this so this we can write it whether this so this we can if you factorize that one you will get it plus R K from where it is coming R K so A transpose our basic A transpose B P B R inverse B transpose R inverse B transpose P plus that one it to plus Q so I just both side I added R here and right hand side also I in the right hand side of the is equation 7 also I added R so this agree so this adding the this is the 7 equation I add R here and R capital R is at both side so it will not change the expression so I have written the left hand side is this one and right hand side is this plus R so this is our basic equation of the left hand side so this can be factorized like this way I plus K Phi minus S B whole transpose R into I plus K Phi S agree Phi S into B K Phi S minus Phi S B whole transpose R this so this can be factorized like this way you just expand this one you will get it this one so if you just tell you briefly we are started from the Riccati equation algebraic Riccati equation then both side I have added that in the not that algebraic Riccati equation I added P S term and separated P S term then after that both side I multiplied by this expression the pre multiplied by B transpose minus S I A transpose inverse and post multiplied by this after multiplying and after multiplying both side pre multiply post multiply and plus R is added left hand side and right hand side then ultimately we got left hand side equation is this one and the right hand side of this one we got it that one this one agree so now see this one from equation this I can write it left hand side I K Phi S plus B whole transpose R plus I plus K Phi S B this is the left hand side is equal to right hand side right hand side what we got it we got it B transpose Phi minus S transpose Q Phi of S plus R so let us call this is equation number 8 now look at this one Q is a Q is a positive semi definite matrix Q is positive semi definite matrix and this quantity will be always positive non negative number for any value of frequency agree so I can write it this and this equation is called the whole equation this equation this equation is called the Kalman return difference equation or identity identity so this equation since Q is greater than equal to zero means positive definite this quantity for any frequency if you sweep from zero to infinity that quantity will be non negative number so I can write it this quantity is always greater than equal to than R so this is the from algebraic equation we got this expression and algebraic equation we need it to solve the what is called gain of the controller to get gain of the controller because we need the value of P and P is the solution of algebraic equation so after getting this one we will see we will now define the gain margin and phase margin of the LQR control systems agree so we can write it this one that equation 8 this equation 8 from equation 8 using s is equal to in frequency domain s is with j omega in 8 we have now i plus k phi s is replaced by j omega so it is with j omega then b whole transpose agree wherever the earlier expression 8 equation number 8 s is there s is replaced by j omega this into r plus i plus k phi j omega b this is equal to b transpose agree is equal to b transpose phi minus j omega transpose k transpose than this equal to not k it is q q then you have a this phi j omega into b plus r so this is equation number 9 that you see this equation I have written it here putting the value of s is equal to j omega in frequency domain so what is the common return difference equation differential equation again so this just I place the s is equal to j omega so from 9 putting that reason that since q is the positive definite matrix positive semi definite matrix for any value of frequency from 0 to infinity if you sweep that this whole expression will be greater than equal to 0 non-negative number because it is pre multiplied and post multiplied by a matrix with this transpose agree if you consider this is a matrix of m q m transpose and since I mean q is the positive definite matrix whole matrix after transformation it will be a positive definite positive semi definite matrix that means this is non-negative number so from 9 we can write it that i plus k phi j omega minus j omega b whole transpose r is equal to pi k phi j omega b this bracket is greater than equal to r so let us call this is equation number 10 and this expression is valid for whether it is a multi input system or single input system this expression is valid for all cases so now consider this situation this special case consider is special case special case that r is equal to we consider r is a weightage in the input input vector so this dimension is m cross m and this is a row which is this quantity is any positive number this equal to i into m so we have consider r is diagonal matrix of each diagonal element is row which is greater than 0 so from this 10 now we can write it from 10 we can write it from 10 we can write it i plus k phi minus j omega b whole transpose into because r is replaced by row i row is will be there and right hand side row will be there it will be cancelled so it will be i k phi j omega b it will be actually row into i r is replaced by row into i so right hand side also row into i so row row cancelled so it will be a simply identity matrix of dimension m cross n so this equation we have observed of this one and if you see we have discussed earlier this quantity this quantity is nothing but a our loop gain if you recollect our previous formulation that what we last class we have discussed see this one it is nothing but a loop gain that this whole thing is nothing but a loop gain of the systems again this g if you consider the gs this is hs gsh is the loop gain so it is this thing is nothing but a k so k into s i minus a inverse whole inverse which is i denoted phi of s into b is a loop gain of this one so if it is a phi s this will be nothing but the whole thing will be g l minus j omega l this whole quantity and its transpose so this will be a phi l j omega s is replaced by j omega when it is a minus sign so this that means we have j l transpose into j l loop gain this is less greater than equal to identity matrix so this is nothing but a loop gain loop gain or loop transfer functions so we can write it now this i plus g l j omega minus whole transpose into i plus g l j omega is greater than equal to identity matrix so this is the expression we got it for l q r system in frequency domain we got it that one plus gs and then you take the conjugate transpose of this one multiplied by this this will be always greater than equal to one let us call this equation is the important equation is representation is very significant we will see later than this equation number eleven so from eleven we can write it now from this one we can write let us call consider a special case means consider it is a single input single output system again this is a single input single output system though output will not come into the picture in through this one it is a our single input system let us call that means our r is equal to one and in this case this dimension will be one cross one so I can write it now one plus g l j omega whole transpose agree whole transpose into one plus g l j omega this is greater than equal to one agree since this is a single input case this is the ratio of two polynomials g l you will get it ultimately if you take the absolute value of that one what is the absolute value of this one and what is the absolute value of this one both absolute value will be same so I can write it one plus g l j omega absolute value square is greater than equal to one agree if this quantity square is greater than equal to one that means absolute value of one plus g l j omega must be greater than equal to one agree so this is the one ultimately you know the expression for g l loop trans functions and our loop trans function we can write it mod of one plus k s i or in frequency remain s that is j omega then a whole inverse b mod is greater than equal to one then what is the representation of that one and it is nothing but a loop trans function of that is g l j omega so let us see is representation in polar plot form so I am just plotting in this real of real of g l j omega part and here is I am y coordinate is imaginary of g l j omega I am plotting agree and this is the our origin and this is the point which is minus one plus j zero point so now I draw a circle of unit radius with a center is minus one comma j zero then we have a this one and this radius is one I have done a circle circle then what is this condition we are getting basically form l square design problem we have to find out the controller law controller gain k is R inverse B transpose P P is the solution of Riccati equation algebraic equation that Riccati equation we have manipulated ultimately we got a condition like this way so if it is a if you now plot it that what is called Nyquist plot of g l j omega let us call g l j omega any let us call this is some plot is that g omega this is minus so what is the distance form from this point to any point on the polar plot of g polar plot of g is nothing but a one plus this is minus one so this is one and this distance is mod of j omega what is called g j omega this so this distance plus this distance will be one plus g l j omega values agree so that that one so this is nothing but a one plus g l g j omega similarly here that if you plot it that what is called our loop transaction nyquist plot it must not cross it will not cross that unit circle and that unit circle is I am just represent by shaded and this is the plot for g l j omega polar plot of g of j omega and any point on this curve that means this indicates that as omega is increasing it is approaching to the zero because it is a what is called real transformation in the sense that it is a low pass plant of this one so this will approach to the zero of this one as omega tends to zero this one and you see what is this from here to here this quantity is one plus g l j omega mod of this one this is mod of this one is less than that this is nothing but one plus g l this this is less than unit circle this condition in order to satisfy this condition this curve then g l j omega that means loop transaction of the system when we have used l q r controller that should not cross the what is called unit circle in the other words it will not enter to the shaded portions by any way this one so look at this expression that our it it does not cross the real axis this one so what is our it cross that what is our gain margin of this one our gain margin of this one is in infinity you can what is the present gain is there from there you can this is the present gain what is there this is the locus of that one and this is the look polar plot of that looped function based on I repeat that this looped function is formed based on the l q r controller design because k is involved in this one the looped function it will never cross the shaded region so our gain we can air form the present gain we can increase the gain up to infinity so use can say whatever the gain present gain is there we found out by solving the what is called l q r problem and what is the present gain we got it and that gain has a you can change the gain up to by a factor of infinity that means you can increase the gain up to infinity still the system will be stable one now this is the present gain we can increase from the present gain what factor we can reduce it so that the system still maintain its stability now you see this point if it is a one this point is minus 2 minus 2 comma j 0 this point this point agree this point is minus 2 this one so this gain this gain whatever gain present gain is there agree at the worst situation it can it can that looped function can touch this one so we can reduce the gain by a factor of half so that it will touch the minus 1 point when you are increasing and decreasing the gain of the present gain of this one phase angle will not change will not alter anything only it will change its magnitude at a particular frequency different frequency the magnitude only will change suppose this frequency at this frequency let us call this is room frequency omega is equal to 4 this frequency what is the magnitude this is the magnitude of this one what is the angle associate of this one this so what is the present gain is there you increase the gain twice so its magnitude only increase by twice but phase angle will be remain same so if some polar plot of loop transaction if it is touching here but it is not entering here it is just touching it cannot enter because it is based on the LQR design problem you cannot enter this one then after that we can decrease the present gain by a factor half so that this present looped transaction nyquist plot will just touch the minus 1 point till then the system is stable so we can say there our gain margin of the LQR design controller based control system we can increase the gain up to infinity and decrease the gain at least that half so our gain margin you see from infinity to half what is the present gain is there let us call present gain what we got it the present gain of the system we got it let us call five so we increase the gain five up to infinity by factor of infinity by if you want to decrease the gain due to some reason the gain is decreasing if you decrease the gain by factor of this half I am telling if the gain is reduced by a factor of half then I can give you guarantee the system will remain stable it will not unstable but below this one has to further investigate but this is the range of gain margin so I just write it this that one the gain just if you summarize the gain from the from the present gain one can one increase the gain up to infinity one one can decrease the gain by a factor of so our gain margin is minus infinity to half by half this one so so equation now you see this is our equation number what is the equation number anyway so let us call this equation number you give it 12 we have given up to up to 11 we have given so this equation number we have given is 12 so from 12 from 12 one can see that what is called this conclusion is made from equation number 12 so before that we study the gain margin those I will just gain margin we have done it phase margin we have to do it just how to study the stability of a control system based on Nyquist stability criteria that I will just briefly discuss here so that it will be easy for you to understand this one so let us call we have a closed loop system like this way so our gs agree our gs is this one and our hs is is a feedback path transformation is that one and this is our cs or ys people are also writing ys this is our rs so our loop transformation is what you see loop transformation is nothing but a from here to you just complete the loop and what is the transformation you get it there is a loop h of s so if you see how to study the stability of the system by using what is called Nyquist stability criteria the first thing is we have to see the what is our Nyquist path our Nyquist path is the whole right up of the s plane agree whole right up of the s plane and this is our real s this is our imaginary s agree and if you have a any pole at the origin then you bend this curve like this way either left hand side right hand side or left hand side bent it so that it should not it should not be value of the function that trans function should not be infinite because you see one if you s s divided by s s plus a numerator divided by s into s plus b when s tends to 0 s is 0 this becomes a infinite this one so this infinite but we just make it limit in this one there is a small this quantity is the epsilon e to the power of j theta when we will just put limiting value and evaluate the function value along the Nyquist path and this is the Nyquist path agree this is the Nyquist path then omega is equal to 0 omega 0 0 omega is equal to we will just write epsilon theta of this one very small value we just go on this one so you can write it omega plus omega is equal to 0 plus this is this is the omega is equal to 0 minus so that r is a epsilon e to the power j omega you going like this way and this is the omega is equal to infinity agree and this is omega is equal to minus infinity so this is is r e to the power of j theta and r is tends to infinity this one so we will find out the loop transfer function nyquist plot loop transfer nyquist plot while we move along this nyquist path from 0 to omega 0 to infinity we will shift once you know from the nyquist plot of loop transfer function from 0 to infinity then minus infinity 0 is the mirror image of that polar plot we can do it this one so our nyquist stability criteria says that that let us call for the given system our nyquist stability and nyquist what is called polar plot of that one is like this way just touching this one and this is the minus one j 0 point agree and it cuts is here and if you see this one with a unit circle if you draw a circle of this one agree and this is the gain cross over frequency this is the gain cross over frequency omega g c and this is the phase cross over frequency phase cross over frequency so our gain margin if it cuts here then reciprocal of this distance will be the our gain margin that means we can increase the gain by a factor what is called reciprocal of that one what is suppose this is a we increase the gain by factor 1 by a so it is a gain margin of this one and if you assume that no poles open loop poles are right up of the s plane then only we can say gain can be increased this one so in general is z is equal to the p plus n agree and what is this the phase gain cross over frequency we will get it what is called phase margin this is the our magnitude of the polar plot and this is the phase angle so we can introduce additional phase this much before the system becomes unstable so we have a this criteria we have to check it this is the you can say number of poles number of poles number of poles open loop poles rather loop transformation loop transformation poles loop transformation poles agree in the right half of the s plane this is n and this n is the this n is the number of number of n circle movement of the point of the critical point minus 1 j 0 number of n circle of the critical point by the polar plot of the loop transformations I mean suppose there is no poles in the right half of the s plane right of the s plane open loop transformation poles there is no poles thus p is 0 then n is n if n does not n circle minus 1 point then p is 0 and also 0 it does not n circle minus 1 point is n circle 0 so p 0 n 0 so z is 0 z 0 means it the system there is no closed loop poles in the right half of the s plane that figure z number figure what we will get z is equal to let us call we got it 0 that means no closed loop poles of the system lies in the right half of the s plane that means system is stable suppose there may be system open loop system is a unstable loop transformation is unstable one and we as we have seen there is a two poles are in the right half of the s plane of the loop transformation or open loop poles the two poles on the right half of the so p value is 2 so in order to become the system 2 that n must be 2 so that this if the encirclement is clockwise if the polar plot n circle the minus 1 point in clockwise then is sign will be considered as a positive if it is n close the minus 1 point in anticlockwise that its sign will be considered negative that means this if the polar plot n circle the minus 1 point clockwise direction twice then will write 2 plus 2 if it n circle the minus 1 point counter clockwise twice then we will write it that 2 minus 2 sign is minus will be considered so in this way we can study the stability of the closed loop system even this system is a non-minimum phase system that means poles in the right half of the s plane if it is there open loop poles that we can study the stability of this one now so now we will see this one that what is called phase margin so what is the gain margin what we have seen if you design a controller based on the l q r controller that controller has a gain margin up to infinity again and that what is the present gain is there of the l q r controller design present gain is there that gain you can reduce by a factor half so gain margin varies from infinity to half of factor I am talking about the factor that what is the present gain is there that gain you can multiply it by a infinity very large number of that factor that means infinity or you can multiply it that present gain of the l q r controller by a factor half before it becomes unstable so it is a very robust even though controller parameter change it guarantees the system is stable this one so let us see is phase margin so let us plot it this one so minus one g 0 this point so I am just plotting this so this is one then this is I am just plotting real of g l j omega this is imaginary of g l j omega again then another circle I am drawing you to this one center of one I am drawing this center this is also no it is just once again I will draw it that one phase margin so this is a minus one g 0 and in this I am real of g l j omega in this an imaginary of g l j omega I am just drawing a circle with a center this of one and this is with a center 0 with radius one I am drawing another circle this is also one and this is also one now this is minus 2 this one is minus 2 now see according to the l q r design problem we have shown it that if your the loop trans function plot is like this way it will never enter to the region of that one so region that is by condition we got it so it may touch it here this thing this thing it may touch it but it will never enter to this one and it may touch this one so if you just add this point and add this point you see this radius is though it is not done properly but this radius is one this also radius is one again and if you just add with the draw a line from here to this is also one this is also one from this triangle if you see this is one because one with this center or with the origin is the center we have drawn a circle of radius one so when the two circles are cross this point let us call this is p 1 point and this is the p 2 point agree that p 1 point from this point to this point this because we have drawn a circle with a unit radius center is minus 1 j 0 so this this this are all is same length so this value will be 60 degree similarly this length and this length 111 so this will be a 60 degree so one can come to conclusion since this curve will not enter to this what is called the shaded region it can touch because why it can touch you see 1 plus k or 1 plus g l j omega mod will be greater than equal to 1 because it is when equal to 1 it will touch this is the condition this one so if it in since it cannot enter to this point with the present gain of the controller so maximum or at least the phase angle will be what 60 because it can touch it here this this curve can touch it here then what is this one if it is this then this is the phase angle of this and suppose it is this one phase angle of this this this one is that agree and this will be 60 that means additional 68 degree phase can be introduced into the system when the controller is designed what is called based on LQR at least 60 it can you can introduce because you can introduce further more than 60 degree so our phase margin phase margin is phase margin is greater than equal to 60 so it will be a 60 and it will be more than 60 because it can touch only it cannot enter in this one if you can enter here then it violates our condition which we derived from the algebraic equation algebraic equation is coming from the design of the controller LQR controller so our phase margin will be greater than equal to 60 at least 60 it may be more than say it will be more than 60 so this is the phase margin of this one so in our short if you design the LQR controller it ensures that our gain margin is infinity and half that means what does it mean we have designed the controller K based on LQR and that gain can be increased by a factor I say increase by a factor up to infinity that means gain what was the gain is gain can go up to infinity and similarly than system will remain stable and similarly the gain can be reduced by a factor half what is the present gain is there let us call present gain is 10 I can go reduce the gain up to 5 up to 5 I can tell the system is stable so if there is a gain variation is there after designing the controller then it is the system will stable in this region that means it is a robust more robust and not only this it also ensures that it is good what will be phase margin also retain that means 60 degree is minimum it may be more than 60 degree of this it will be more than 60 so let us take the or just if I write it the since the NICUSD plot since the NICUSD plot plot of an optimal regulator it must avoid the unit the unit circle shaded region shaded region centered at minus 1 j 0 so our and our possible points possible points are that we have shown it our possible points are this one p 1 and the p 2 this is a two possible points are there points are points are p 1 and p 2 and p 1 p 2 if you see the p 2 is 60 degree so one that means it is coordinate is minus half minus j root 3 by 2 this and this coordinate is minus half plus j root 3 by 2 again this so this is the our ultimate conclusion if you recollect our earlier example example let us see what is our gain margin and phase margin what we will achieve after use implementing through what is calcular controller if you recollect our earlier example that is x x is equal to 0 1 minus 2 2 x then b 0 1 that is b and our performing index is half 0 to infinity x 1 square plus x 2 square plus twice u square of this d t and you have to put in proper what is called expression format then you apply the l q r controller that we have solved it earlier you just recall the earlier example and our problem is to design a controller u is equal to minus x t where x is the controller gain based on the l q r design technique and we got the controller gain if you recollect we got the controller gain 0.121 and 4.178 the controller gain if you recollect and what is our loop transform once you get the controller gain how you got it we solve the rickety equation then we got it k is equal to r inverse b transpose p p u know b u know r u know from this expression so once i know this one i can find out g l j omega g l j omega will be coming if you do this one k s i minus a s i minus a whole inverse b this is our what is called g l and put s is equal to j omega and if you put it this one g this g l j g l s i am getting it 0.121 plus 4.178 s divided by s square minus twice s plus 2 if you do this operation you will get it that one so you know you plot the nyquist plot of that one if you do the nyquist plot of this one what you will get it you will see this one i am just i know how to plot the nyquist plot you just put it you see this figure nyquist plot this is the in this axis real of g l j omega and in this axis the imaginary of g l j omega g l j omega plot it then it will see it will start from here as omega is equal to 0 it is here when omega is increasing this g l plot this is the g l j omega plot where this is the omega is equal to 0 plus and this is the origin 0 0 and this is the omega is equal to infinity omega is equal to infinity plus this you got it this one now see this one our two point minus two points is here this one it is outside this it is not entering to this one the nyquist plot of that one is not entering to this one our if you draw a circle pi with a minus one one circle of that one you will not enter this one minus one of that one so you can find out it is the gain margin gain margin is infinity you see it will not cut here as you increase the gain of this one it will be infinity the gain margin from the present gain if you decrease the gain by factor half still then this will be a stable of this one agree so at least half it may be less than half also it will be stable this one then if you see the body plot of this one body plot of g l j omega this is the thing and from the body plot of this one the gain margin the phase margin you see sixty sixty point you are getting the phase margin is sixty point seven degree and how we according to theorem it is told at least sixty degree that phase margin phase margin is phase margin pm is sixty degree greater than equal to sixty degree we are getting sixty point in and our phase margin and gain margin is you see our gain margin is equal to minus six point two four d b minus six point two four d b that you got it that one agree that you can easily find out what is what factor is there you can reduce the present gain of the controller and it occurs at omega is equal to fourteen point one one point four three read per second agree so this very very verified our what is called statement we made it in l q r control phase margin is greater than equal to sixty and the gain margin is gain is very infinity and by a factor of half also we will stop it here today