 last class we have discussed the statement of the what is called minimum time control problem of a linear time invariant system. Let us recap this statement of the problem and then we explain the solution of minimum time optimum control problem with an example. So, let us call the linear dynamic system is given by x dot is equal to A x plus B u, u is the control input and x of t 0 at time t 0 initial time t 0 is x of 0 is given. So, our problem is to drive the state from initial time t is equal to 0 the state value is at 0 drive this state to a final state at t is equal to t f where x f is given in a minimum time. So, that is our problem. So, first we have to check whether the system is completely controllable or not by the what is called this rank condition we have to satisfy B A B A square B A n minus 1 B n is the number of states involved in the system dynamic system that rank must be n then all the states will be controllable and not only this we have a constraint on the input most of the physical system having a definite input to the systems agree. So, that constraints are given maximum value of input to the plant u max and minimum value of the plant is you mean agree. Generally, this upper and lower limit are same with positive sign and negative sign this one. So, our problem statement is like this way it is desired to apply an optimum control input u star that satisfy the constraint and now in case of this alpha 1 we have constraint the 1 unit you have input for all the input i is equal to 1 to m is the number of inputs drives the state of the system initial state x 0 to the desired final state x f agree in a minimum time. So, our performing index is this performing index we have to minimize that means we have to find out the minimum value of the time t f for that one and that is been solved by using what is called contagion principle minimum principle P M P and when the x 1 our terminal state or the final state is 0 at the origin we want to drive the initial state to the origin then the problem is called optimal time optimal regulator problems. So, that this is our problem statement was that and we have shown it last class and derived how to approach this one by using the contagion minimum principle. Let us take our one example, so that we drive the state from initial state x t 0 u which is equal to x of 0 to the final state x t f is equal to 0 in a minimum time t f by using what is called switching the control law in two state either plus 1 or minus 1. So, that is called bank bank control bank bank control, so what is bank bank control a control signal which always takes which always take its maximum always takes its maximum or minimum value finitely many switching between them, between them minimum and maximum value between them is called a bank bank control. So, the two maximum and minimum state is there for controlling either you switch on plus 1 or you switch on minus 1 and the state will drive from initial this control action will drive the state from initial state x t is equal to 0 to the final state x t f is equal to 0 at the origin in minimum time t f for any initial condition x 0 to a final state x t f is equal to 0 will drive the initial state x 0 to 0 by proper sequence of control actions. That means, either you switch on to plus 1 or minus 1 in this way and many times you have to do depending upon the order of the systems. So, let us take n 1 example and illustrate the problem the minimum time optimal control problems. So, given the dynamic system is given the system whose dynamics are expressed in this form that x 1 dot of t there are two state. Let us call we consider the second order system which is expressed in time domain and in general we write x dot of t which has a two states are there dimension of this equal to it is given at 0 1 0 0 and there is a x 1 of t x 2 of t and that is 0 1 of u of t. So, our equation is this is a matrix this is a state vector this is the b matrix if it is single input we write generally small b and this is the u of t and if it is a multi input capital B and capital U this. So, this is our dynamic equation with the performing index with the performing index j is equal to t 0 to t f t 0 is equal to 0 and d t which is nothing, but a t f that means we have to minimize that performing index with the performing index minimize the performing index with minimize the performing index this is the performing index is minimized not only minimized with the constant control input constant mod of this is equal to less than equal to 1 and this constant means that our control input is plus 1 to minus 1 this constant means that the control input must be must be control input magnitude must be within 1 or not greater than 1 must be within 1 or greater than this is 1 means this that is our problem. So, how to solve this problem so our basic problem is our problem is to transfer the state x of t 0 initial state transfer the initial you can write it initial state x of 0 to x of 0 is this to the final state x of t f is equal to 0 means origin in minimum time when t f must be minimum. So, if you recollect it just state given the system our problem is to transfer the state initial state to the final state t x 0 t f to 0 means origin in a minimum time by minimizing this performing index not only that a subject to constant control input constant that magnitude of u cannot be greater than 1 or within 1 so that is problem. So, the solution of the problem if you follow the what we have discussed last class first you form a Hamiltonian matrix that our performing index if you see that part is 1 coefficient of this is 1. So, 1 plus lambda transpose of t into a of x t plus b u of t that is our this and let us write since we have a number of states is 2. So, the dimension of lambda is also 2 rho 1 column so it is a transpose. So, if I write the each element of lambda lambda 1 of t partition lambda 2 of t write corresponding matrix a b in this expression. So, our a matrix is if you see the or a matrix is 0 1 0 0 multiplied by x x means x 1 of t and x 2 of t. So, multiplied by b b is 0 1 then u of t. So, now you simplify this one if you simplify this one you will get it 1 plus lambda 1 of t lambda 2 of t then this into this this into this. So, it will be a x 2 of this and this into this this into this 0 plus u of t so that which is nothing but a further expanding this one lambda 1 of t x 2 of t plus lambda 2 of t u of t. Let us call this equation is 1. Now, see the Hamiltonian matrix that is a linear function in u and not only that we can if we use the what is called Pontesian minimum principle then this function will be minimum when this value of this one is minimum. So, that only possible by selecting the value of u of t with the knowledge of lambda of t. So, the costate vector the costate equation or vector. So, costate equation R A what is the costate lambda dot is equal to lambda dot of t is equal to minus del h del x of t. That is our basic equation that we have seen from calculus of variation how to optimize the dynamic systems this is the things. So, this x is the dimension of 2 so lambda also dimension of 2. So, this we can write it further we can write it minus see each function I have to differentiate with respect to x. So, there is no x term involved in the expression 1. So, that will be a 0 then differentiate this gradient of this with respect to x 2. So, this is the only term is there. So, it is lambda 1. So, lambda 1 of t. So, the costate vector expression is this one and we can write it because it has a 2 components and that 2 components is lambda 1 dot is equal to 0 another is lambda 2 dot is equal to minus lambda 1 of t. So, let us call this equation is 2 and this equation is 3. So, we can easily solve the equation 2 and 3 in general even if you get the what is called the matrix is not a special structure in all elements are there we know how to solve the what is called state equation. Here also we will come this type of equation and we know how to this x dot is equal to something like a x form you will get it you can solve. So, looking from this one I can write it first see from equation 2 from 2 what you can write it integrate that one with respect to that is delta 1 is nothing but a delta 1 dot is in a lambda 1 dot is nothing but a this thing. So, this is equal to 0. So, now this implies that lambda 1 of t is equal to lambda 1 of 0 let us call this equation is equal to equation number 4. So, you take this that side then integrate from 0 to t that will say that will come lambda 1 of t minus lambda 1 of 0 and right inside 0. So, this is the expression and use this expression in equation 3 from equation 3 lambda 2 dot of t is equal to minus lambda 1 of t which is equal to minus lambda 1 of 0 lambda 1 of 0 is replacing this is that one. So, what is the solution of that one the solution of that one I can get it lambda 2 of t or you write it this lambda t of t d of t is equal to minus lambda 1 of 0 this. So, now take d t this is and then integrate from 0 to t. So, this shows that lambda sorry lambda 2 of t is equal to minus lambda 1 of 0 into t and lower limit t is 0. So, this term will not be there then another term is there lambda 2 of 0. So, this is the our solution of that lambda 2 expression. So, this expression let us call this is equation number 5. So, from 4 and 5 I can now say from equation 1 it means Hamiltonian equation h of form equation 1 this equal to 1 plus lambda 1 of t into x of t plus lambda 2 of t into u of t. So, using pointage and minimum principle I can say that when lambda 2 is positive u 2 is negative we will consider then this function value will be minimum. Then when lambda 2 is negative u 2 value is positive. So, what we write in the optimal value of this u star of t is equal to 1 if lambda 2 of t is less than 0 and that is equal to minus 1 if lambda 2 of t is greater than 1. So, it is just switching depending upon the value of lambda 2 of t and lambda 2 of t expression is this run unfortunate part of this one we do not know what is lambda 1 of 0 and lambda 2 of 0. So, this 2 equation we can write in mathematical form by using the sign function sorry sign function u star of t is equal to minus sign of lambda 2 of t agree sign lambda you know the expression for lambda 2 or sign that lambda 2 expression is that one lambda 1 lambda 2 of 0 minus lambda 1 of 0 into t. So, that I am writing lambda 2 0 minus lambda 1 0 into t. So, this so what is the sign function I just explain this sign of z mean g sign s i g n s i g n s i g n sign of z is equal to it is 1 if z is greater than 1 or sorry greater than 0 if it is minus 1 if z is less than 0. So, the sign function sign of z value will be 1 if z is greater than 1 value will be minus 1 if it is less than 0 means negative. So, it is switching only u is switching to plus 1 or minus 1. So, this quantity when it is positive then u I am switching to a minus 1 when this quantity is negative that negative 1 1 1 plus I am switching to plus 1. So, the our control exchange is switching control law either you I am switching to plus 1 volt or minus 1 volt or 1 unit minus 1 unit. So, it is something like sign function is that 1 if you see. So, let us call this is lambda 2 of 0 this is 1 u of t this is minus 1 this is 0. So, now look at this expression when this is positive u is negative then we are applying the voltage to the we are applying the input to the system is minus 1 and correspondingly system dynamics will change when this is negative sign this negative sign of this negative quantity is the negative negative positive then we are applying positive control signal voltage or signal again. So, again the system dynamics will change it. So, now see 1 by 1 what we are doing now if u star of t is equal to 1 u star t is 1 when this quantity is negative then sign of negative quantity is minus sign that by definition of. So, if it is 1 let us see our corresponding dynamic equation of the system x 1 dot is equal to x 2 of t then x 2 dot x 2 dot of t is equal to 1 because x 2 dot is equal to u is equal to 1. So, now what is the solution of this one the solution of x 2 of t is equal to minus this d t t plus x 2 of 0. So, this is our solution of x 2. So, if you put in this expression that is x 1 of dot of t is equal to x 2 which you can write it x 2 0 x 2 0 plus t. So, now what is the solution of that one solution of this one x 1 of t is equal to that x 2 of 0 into t agree because this lower limit is 0 and upper limit is t. So, it will be coming t. So, this one is t square by 2 upper limit is t and lower limit means that lower limit term will not come from this integration part. So, plus x 1 of 0. So, this is our solution of that one that x 1 you can write it x 1 of 0 plus x 2 of 0 into t plus t square by 2. So, that now this I can write it into a say what is x 1 of 0 I am writing this plus x 2 of 0 the initial condition of the state and t what you can write it from this expression you see t is what x t of t minus x 2 of 0 is equal to t is equal to this. So, put the value of t here that x t of x 2 of t minus x 2 of 0 this is that one put the value of this that is x 2 of t minus x 2 of 0 whole square divided by 2. Now, if you simplify that one because just you simplify this one then this equation ultimately you see this is x 2 square x 2 a minus b whole square x 2 square by 2. So, it will come x 2 square by 2 and plus x 2 square by 2 and here will x 2 square only. So, it will be a minus x 2 square by 2 then twice x 2 x 0 x 2 x 0. So, that is 1 x 2 x 0 here. So, that will be plus x 2 x 0. So, let us write it that next is this term is there x 1 of 0 I can write it now see this one. So, that will be a this into this. So, minus x 2 square, but here is half. So, minus is coming then x 2 0 into x 2 t here is twice x 2 0 into x t divided by 2. So, 1 so that will be cancel out. So, ultimately we will get it this expression after simplifying this one. So, x 2 square by 2 minus x 2 square by 0 and x 1 of 0 for u is equal to plus 1 positive this. Let us call this equation what is the equation we have come across up to 5 last equation is up to 5 this equation we have up to 5. So, let us call this equation is 6 this is equation number 6. Similarly, we will see when we will apply you see the dynamics of the closed loop solution or response of the system is this when you put the value of input is minus because control action is applied different minus 1 then what is that solution or the trajectory of x 1 and x 2 you see for u star of t is equal to negative the state equation is x 1 of t is equal to x 2 of t that equation or this one another is x 2 dot of t is equal to u and u is minus 1. Similarly, I can find out what is the value of x 2 of t by solving simple integrating both side and taking the limit t is equal to 0 to t is equal to t. So, this equal to your will be x 2 0 again minus x 2 0 minus t. So, this is the solution of this one then what is this x 1 t dot is equal to x 2 t and what is x 2 t is nothing but x of 0 minus t. Now, you integrate this both side and with a lower and upper limit t is equal to 0 to t is equal to t then you will get x 1 of t is equal to that x 1 of 0 then it will come plus x 2 of 0 into t then t square by 2. Now, let us call this equation is you will not now put the value of t what is t expression t is equal to you can write it x 2 0 minus x 2 of t that is our expression for t x 2 0 minus x 2 of t. So, put this value here x 1 of 0 plus x 2 of 0 and the value of t is just now here x 2 of 0 minus x 2 of t. So, minus t square and x 2 of 0 minus x 2 of t whole square by 2. So, after simplification this one as we have discussed earlier that case you will get it this value will get it that x 1 of t that is x 1 of t you will get minus x 2 square of t by 2 plus x 1 of 0 plus x 2 square of 2 x 2 square of 2 by 2. See the difference for u is equal to minus 1 see the difference this if I write it in the same manner of that one x 1 x 2 square this expression you can say is nothing but this one if I write this one x 2 square of x 2 square of this by 2 then this is a plus and I can write it is a minus plus x 1 of 0 minus x 2 square of 0 by 2. Just if you see this one so this let us call this is equation number 6 this is equation number 6 instead of this one this is 6. Now, look this expression and this expression this is equation number 7. So, when the control input u is applied the solution of trajectory of x 1 and x 2 is how they differ this x 2 square by 2. So, here is minus x 2 square by 2 then this constant term which depends on the initial condition of the state this x 1 0 plus x 2 square of 2. So, this is the two equation now easily we can plot the trajectory of what is called equation 7 and 8 6 and 7 you can plot it in phase plane there are two states are there and we can plot it this and basically this equation 6 and 7 if you look the equation 6 and 7 is a parabola equation. Both represent parabola equation depending upon the initial condition the parabola will be different, but nature of this in phase plane is a parabola. So, let us see if you plot it this what is the nature of this curve we will get it. So, from equation 6 and 7 from equation 6 and 7 we have one you see x 2 square of t divided by 2 6 let us call this one I am writing this x 2 square of this is equal to this equal to x 1 of t minus c 1 agree where c 1 is equal to c 1 is equal to say here this I am keeping it is from equation this is this I am taking this whole thing I am considering as a c. So, c 1 is equal to x 1 0 minus x 2 square 0 by 2. So, that is from equation 6 I am writing similarly from equation 7 I can write x 2 square of t by 2 is equal to minus x 1 plus c 2 and where c 2 is equal to say equation 7 this equation 7 if I take this is that side x square by t s square t of 2 is equal to minus x 1. So, and plus this is you write it c 2 and this is you write it c 1 this is c 1 agree. So, this where c 2 is equal to x 1 of 0 minus plus x 2 square of 0 by 2. So, this is the two parallel equation a y square is equal to 4 a x plus some constant term when constant term is there that what is shifted to the right or left of this one of the parameter. So, let us see if you plot this one and this is for this expression for u is equal to plus 1 and this is u is equal to minus 1 this corresponding u is equal to minus 1 and this correspond this equation corresponds to is equal to plus 1 this equation agree. So, let us plot it in phase plane. So, there are two states are there. So, x 1 and x 2 I am showing here x 2 and this is 0. Let us call c 1 is equal to 0 that c 1 is 0 then what is this one is a equation of parabola when x 1 is 0 x 2 is also 0. So, it is when x 1 is some positive quantity then x 2 is plus minus. So, this nature of the curve is like this way and this is correspond to c 1 is equal to 0. Now, tell me when c 1 is greater than 0 when c is greater than 0 what will be the its nature of this curve when c 2 c 1 is greater than 0 what will be this value. So, this value now c 1 is greater than 0 if it is there this curve will be like this way. So, I am just writing in this side c 1 is greater than 0, but all this cases u is c 1 greater u is plus 1 and all this cases are u is I can write it u is plus 1 here also u is plus 1 u is equal to u is equal to plus 1 this c. Now, c 1 is less than 0 less than 0 means if you put it that side less than 0 is some below of x that this will be looks like this way. So, in this side c 1 is equal to less than 0 and this is c 1 is 0 is this one. So, this is corresponding to this all these things corresponding to u is equal to plus 1. Now, let us see for this one when control input is applied u is equal to minus 1 what is this you will get it. So, again consider c 2 is 0 if c 2 is 0 then this is you see y is equal to minus 4 A x when x is equal to x 1 is equal to c 2 is 0 when x 1 is equal to let us call 0 x 2 is 0. So, it will start from this one when x 1 is minus minus minus plus the x 2 is plus minus. So, this will be a curve is like this way. So, this is c 2 is equal to 0 agree when c 2 is positive when c 2 is telling me which side I have to draw it that one c 2 is positive, but x 1 is negative c 2 is positive x 1 is negative. So, this will be a because x same below of x the x 2 value will be more. So, c 2 is positive then our curve will be like this way. So, this side c 2 is positive and now c 2 is negative c 2 is negative agree c 2 is negative and x 2 also negative. So, that value will be below the c 2 curve. So, this is a c 2 less than 0 and all this curve this curve u is equal to minus 1 this curve is u is equal to minus 1. Now, see our initial condition now question is coming look at this expression our initial condition can be anywhere in the 4 quadrant. Let us call our initial condition is here and just showing you our initial condition is here x 0 is here then what is the dynamic equation is there x 2 dot is equal to x 1 and x 2 sorry x x 1 dot is equal to x 2 x 1 dot is equal to x 2 and x 2 dot is equal to u and u value is your may be plus 1 or minus 1 agree. So, u 1 is equal to either plus 1 or minus 1 let us call this is that one. So, it can this point can lie either this green curves parabola or red parabolas anywhere you can write it. So, let us call it is here. So, what is the value of x 2 positive x 2 value is see here x 2 value is positive if x 2 value is positive then x 1 dot is positive then which direction the velocity is positive then which direction x 1 will move x 1 will increase because this derivative is positive x 1 is increase that means it will go like this way. I as I told you it can be in the red colored parabola or green colored parabola. So, if it is red color parabola is lies then it should increase agree. So, it is going away from the origin, but if it is in the what is called that green parabola. So, x dot x 1 dot is positive. So, x should increase. So, the curve x is increasing along this curve see this one. So, if it is a x 1 it is going like this way. So, it is approaching it is approaching to because x 1 is increasing agree, but if it is if it is in this curve let us call it is a red curve. So, x 1 is increase. So, it will move like this way it will move like this way agree. So, it is going away from the origin suppose it is on the green color green parabola. So, x 1 should increase. So, it is going in this way agree and it is approaching to the origin. So, if it is a approach if it is like this way let us call it is coming here. So, till x 2 is positive sorry x 2 is positive the x 1 should increase when it comes here when it comes here x 2 is negative x 2 is negative means what x 1 is negative. That means x 1 should decrease and see it is decreasing it is decreasing and decreasing in this way decreasing. So, when it hits here when it hits here agree then what is this one this is the trajectory for when u is equal to 1 and this is here it is going along the green trajectory dotted green trajectory and u is equal to 1 when it hits here that u is still 1 u is still 1 u is still 1, but it hits the that switching surface this one c is equal to 0 when it is 0 still this u value is 1 agree this u value is 1 and this u value is what minus this when you are coming here the u is equal to minus 1, but when it hits here u is equal to plus 1. So, it switch here agree and you see x 2 is negative that x 1 is decreasing decreasing and it is ultimately it will come to origin here. So, if you see this one our switching surface is at this point you see x 2 is the initial condition at this point that x 2 once again I am telling you let us call our initial condition is this one x of 0 and x of 0 means x 2 is positive one x 2 is positive see x 2 is positive x 1 should increase. So, it may fall in this parabola or it may this point may lie on this parabola I am telling you suppose it is lying on this parabola agree. So, x 1 should increase. So, it will go this way it is going away from the origin because we have to drive the state to the towards the origin and now if it is in the green parabola that means equation number 7 agree u is minus 1 and this trajectory is u is equal to minus. So, it will drive this one in this direction because u x is x 1 dot is positive since x 2 is positive. So, it is going and x 1 is increasing increasing and x 1 is increasing in this way when it is this at this point x 2 is x 2 value is negative negative mean x 2 x 1 value should decrease you see it is decreasing this one value from here to here x 1 is decreasing. When it hits here u value is changed previously u was minus 1 now you see this it hits here u is equal to your 1 it hits here also you see it hits here also no doubt, but if it is it cannot go it cannot reach to the origin it is going like this way. So, it if it hits here then along this path u is equal to minus 1 along this path x 2 is always negative means x 1 is decreasing and approaching to 0 this. So, our trajectory of this switching trajectory is that one when c 1 is equal to 0 this is our trajectory switching trajectory. Now, what about this one in this case suppose our point is here our point is here again. So, our initial point is here. So, what is the value of our state x 2 is positive x 2 is positive. So, what is this x 1 should increase so once again it may fall what is called in the this is the dotted line at it may be a fall with this dotted line. That means, this is corresponding to the equation 6 and this dotted line equation 7 suppose it it is falls on the equation of that red line. So, x 2 now what is the x 2 x 2 is positive x 1 should increase increase means increase means it should go towards this because minus 1 suppose minus x 1 is minus then it should go towards direction x 1. So, if it is go towards this one it is going away from the origin. Suppose it is coming here now suppose this. So, our at this point x 2 is positive now whether it will move along the red parabola or along the green parabola this that is our question now. Suppose it is following like this way in the red parabola that means u is equal to our plus 1 u is equal to plus 1 and the x value is increasing increasing. So, this it is increasing. So, when it hits here when it hits here then u value is your negative u is u value is negative agree, but at this moment u value was positive when it hits here the u value that means switching occurs here when c 2 is this is c 2 is 0. So, our trajectory switching curve will be that one now one maker why not it will follow with this green curve why not it will follow with the green agree. Suppose it is in the green curve that means x 2 is positive x 1 must increase x 1 must increase it this one and it is increasing. So, it will go like this way this way this way this way and it is going away from the origin. So, it has to go in this direction. So, u is equal to e is equal to plus 1 and then you switch to e is equal to minus 1. So, our switching curve in this ultimately it is the that is our switching curve. So, this curve is c 1 is equal to 0 from equation 6 from 6 and this is c 2 is equal to 0 from equation 7. So, once it is hit here it will follow along the switching curve follow this switching curve and ultimately it will reach to the origin. So, we can write our control law you see now the control law u star of t is equal to minus sin of lambda 2 and lambda 2 is what lambda 2 of 0 minus lambda 1 of 0 into t. So, this again this is our control law. So, from 6 and 7 when c 1 is equal to c 2 is equal to 0 note that only one parabola from each family from each family. Family passes through the specified terminal from the specified terminal point x is equal to 0 and 0 transpose. That means, if you see this one from 6 and 7 if you this initial condition is there anywhere in fourth quadrant anywhere in the sorry first quadrant then it will move along the u is equal to first u is equal to minus 1 switch is there you have to make the switch is equal to minus 1 then it will go continue along this path. As soon as this hit the switching curve that means, u is equal to plus 1 it says it will follow along this curve and attain reach to the origin. If it is here again it will switch to a minus 1 first and then it will switch to a plus 1 control input anywhere here it will first switch to u is equal to plus 1 and then switch to u is equal to minus 1 anywhere here suppose here you are calling here here suppose here it is just above the switching line above the this is if it is here above the switching line. If it is initial point above the switching curve then it will switch to u is equal to minus 1 then it will switch to u is equal to plus 1 if it is below the switching line below the switching line first it will switch to u is equal to 1 then it will switch to u is equal to minus 1. So, this is the optimal time it will require along this trajectory of this one. So, segments of the two parabola segments of the two parabolas through origin form the switching. So, this one segment of two parabolas two familiar parabolas that segment of this one once one is this one and another parabola this is the set of family of parabolas which is passing through the origin and that intersect and that will form the switching curve. So, equation of the switching curve will discuss later and we will how to take the decision when that u plus 1 to minus 1 how to take will make some logic behind this will explain this