 We have data which is input and output data, we have inputs u known, we have output measurements coming from the plant and we have the model so we know 5 gamma c matrix we have data. Now you can appreciate that it is sufficient to estimate x0 that is state at time 0 because if you have the model if you know the inputs then you know you can x1 and u1 will give you x2 and so on you can just go recursively using this model online to construct subsequent. So the key thing is what is the initial state just imagine that you have some real plant okay and then you want to start estimating some variable you are going to start using the model online okay. Now you have everything the data is coming to you okay why data is you are connected with data equation system so why data is coming to you inputs manipulate inputs are something that operator sets or a controller sets so the computer knows about it okay. So now what is not known to me when I want to kick off my state estimator is x0 initial state I do not know what is initial state so I have to give a guess okay what should happen is when my model starts running online in parallel with the plant I am going to run the model parallel with the plant in real time okay. So k k plus 1 k plus 2 let us say my sampling instant is one second okay when the plant advances in time by one second the model will advance in time in real time on my computer in one second okay. Now if I want what I would want ideally model and the plant should you know at some point at least they should become identical the model output should become close to the plant output model state should become close to the plant state then only I can use the model at the state estimator otherwise I cannot okay. Now the problem is when I am using this model online let us take a simplest case where d is 0 you have only u there are no unknown inputs so you are giving this u okay let us assume that measurement noise is 0 there is no disturbance most ideal case even then there is a problem because you do not know x0 okay. So I have a perfect model there is no disturbance I am taking the situation where there is no measurement error okay only possible error now I can commit is in the initial state x0 see because the true plant will have some initial state x0 and I have to guess because x is not measured so I have to give a guess I give a calculated guess I will give a good guess even then it is a guess okay. So when I am guessing what is the guarantee that the model predictions will be close to the true value okay so just imagine the scenario this is something different than what we have done earlier we were trying to model the plant now I am going to run this model online okay in real time. So as time progresses the model also advances in time so model time and the real time are matched okay so I want to estimate this sequence and then you will see that it is sufficient to estimate x0 and then we started formulating this problem of estimating x0 let us assume that x0 is the x0 hat is the initial guess that you are going to give and you know the input sequence okay you know the input sequence you have the model. So I can use x0 if I have a guess for x0 I can use it to estimate x hat 1 because I know u0 I know gamma I know phi okay so in my computer I advance in time I use I estimate x hat 1 I can estimate x hat 2, x hat 2 will be function of u0 and u1 okay but it also function of x0 okay initial guess that you make okay also has influence on how you estimate x2 okay you can go on doing this and you can show that actually you know x3 x3 will be function of phi cube x0 phi square u0 plus there will be a u1 term and u2 term okay so with reference to time 0 what is going to happen in future okay consist of two components one component which comes because of the inputs that are given after time 0 u0 u1 u2 u3 other thing is you know information about the system passed in the system that is x0 okay there are two things which influence how the system behaves so how do I find out x0 okay. So what I have done last time that I want to estimate x0 using the measurements I have measurements y0 y1 y2 I am taking measurements okay as the time advances I am taking measurements now I want to use this measurements I want to use the model okay and then reconstruct x0 from these measurements and the model okay so I know the inputs my first equation is this see x0 is equal to y0 you might wonder you have this equation why cannot you estimate x0 from this equation what is the trouble not those who already done the control course should tell me what is the problem why cannot use this one equation how many states do you measure typically in a real plan I have a distillation column okay I might be having some 10 sensors there are 100 states okay what will be dimension of C matrix C matrix there are 10 measurements and there are 100 states C will be 10 cross 100 can you solve this equation you cannot there are more unknowns than the number of equations there are 10 equations under unknowns you cannot solve this equation you cannot use only one equation see let us take the simplest case CSTR problem in the CSTR problem we said we have two states whether two states temperature and concentration what is the measurement temperature okay using one temperature measurement can I estimate concentration and temperature see only I will have one equation see I have one temperature measurement T0 this is equal to 0 1 this is my C matrix into CA0 T0 using this one equation I have just one equation can I estimate can I estimate CA0 from one equation I cannot okay so in general the number of measurements are in general very very small compared to number of states in a real plan okay so using one equation two equations you cannot estimate X0 one equation is not sufficient okay so I can add I have I can use the redundancy in measurements to create more equations okay one is not sufficient I can create two equations three equations four equations okay and then I can collect enough number of equations so that I can uniquely estimate initial state okay so what I want to do now is I want to collect more equations one equation is not sufficient to estimate X0 so I am collecting one more equation I am writing CX1 is equal to Y1 is everyone with me with this yeah so all that I have done now is I have rearranged it in such a way that unknown part is on the left hand side okay and everything that is known Y1 is known to me okay C is known to me gamma is known to me U0 is known to me I have just taken it on the right hand side okay so likewise if I go on doing this okay I will get these equations I have just written unknown component on the left hand side I have written known component on the right hand side how many such equations I am going to collect I am going to collect N equations what is N? N is equal to number of states in this particular case for CSTR problem there are two states I just need two equations okay for a distillation column where there are hundred states and ten measurements I would need to stack hundred equations okay yeah we will be coming to that but before that I want to before I do data fitting okay where is the need to do data fitting I will come to that right now there is no error right see I am taking the most ideal situation Y is error free okay if Y is error free okay then I do not want to take more number of equations there is everything is perfect there are no errors I just take exact number of equations and solve linear algebraic equations okay that is my game plan right now so now what I am going to do is I am going to combine all these equations into one big equation I am just going to combine all these equations into one big equations what is not known to me is this vector x0 okay this matrix is known to me okay I have measurements of y0 y1 up to yn-1 I know inputs u0 u1 up to un-1 so I know all these inputs okay so I can take all the known terms on the right hand side okay and this is like ax equal to b right this is an equation which is linear algebraic equation okay what will decide when you can uniquely find x0 rank of a matrix what it should be full rank what will be the dimension of a matrix if there are 10 measurements okay and 100 states what will be the dimension of a matrix so it will be nr cross n okay you have stacked n equations okay each one of them there are r equations corresponding to each time point you have such stacked n such equations so there are nr equations okay in n unknowns so this matrix is not a square matrix this matrix is not a square matrix this is a non-square matrix okay in order that you can uniquely find x0 rank of this matrix should be equal to n this is a fundamental condition on the dynamic model discrete dynamic model most ideal situation no noise no disturbance everything is perfect model is perfect I do not know x0 the question is can I recover x0 from the measurements of y and u okay this problem or this question can be fundamentally answered just looking at rank of this matrix okay so this is a property of the linear dynamic model this is called as observability okay a system is said to be observable provided this rank is equal to n equal to system dimension okay so this is one of the fundamental properties of a linear discrete time or you can have a equivalent definition for a continuous time model this is for the discrete time model in the continuous time model you will get cca ca square ca to the power n-1 okay you can estimate initial state uniquely from the measurements only if and only if this rank is equal to n if it is not equal to n whatever you do you collect more measurements you do anything you cannot uniquely estimate uniqueness is only guaranteed by this condition okay yeah PFR in the case of PFR you discretize and then you have large number of states still you will have few measurements see I am going to take a PFR example towards the end okay you will discretize it let us go to the PFR so this is my fluxor reactor okay and you know what I would like to know here is the state profile temperature profile or concentration profile inside the reactor okay how many at how many points well if you start by taking number of points infinite number of points okay so actually see a distillation column is a high dimensional system this is an infinite dimensional system okay but for the practical purpose one can discretize okay and create compartments pseudo compartments even so corresponding to that see there will be we have done this is the model and then you know we had done this compartments of 19 compartments we have done and there are 80 states but we have only 5 temperature measurements the question is can I estimate concentration profile and temperature profile inside the reactor using just 5 temperature measurements okay or 6 temperature measurements now what is critical why this is important is suppose suppose I will to choose see here we have taken 6 temperature measurements the question is are 6 temperature measurements enough to reconstruct the state can I reconstruct 80 states using 6 measurements is a fundamental question this will depend upon rank of that particular matrix linearized matrix now how is this relevant it is not just algebraic condition suppose the rank is not equal to n you should add more measurements so that rank of that new matrix so you should change c matrix you should change the number of measurements that you need to obtain to get a unique reconstruction are you getting my point see what is the use of this what is the use of this so what is the use of this condition okay suppose you have chosen certain number of measurements for a given system you will get a corresponding c matrix for that okay with that c matrix you actually compute the rank of this c phi and all that you will get you will get rank of this matrix the rank is not equal to n to make it equal to n you will have to add more measurements okay when you add more measurements structure of c matrix will change okay so when should you stop how many measurements to be added see this is a fundamental question when I have a plant which has large number of states how many measurements I need to have to unique to be able to uniquely reconstruct the state you can add more if you want but what is the minimum number you should make sure that this rank condition is met okay suppose you have a c matrix in which you know you add more measurements such that this condition is met is not a problem but if you add less and this becomes rank efficient you cannot estimate the state uniquely this is what you have to remember okay so this is something this is a tool which can be used at a design of a sensor network very very important tool when you design a sensor network how do you choose how many minimum number of sensors are required to estimate the state uniquely that is the fundamental question that can be answered for linear dynamic models that can be answered using analytical tools linear algebra okay so your linear algebra understanding is deeply linked with how do you design your sensor network okay so this is called as observability matrix and this is one of the fundamental properties of the system now let us go back to our CSTR example this was my phi okay I wanted to estimate concentration using temperature so my c matrix is this okay in the state the second state is temperature first state is concentration so if I construct this matrix c and c phi what is n? n is equal to 2 okay look at this matrix it should be c, c phi up to c phi to the power n-1 when there are two states you just need you know you just need two things okay rank of this matrix is 2 which means you are guaranteed to get estimates of concentration just from temperature measurements okay just from temperature measurement you are guaranteed to get so this is a fundamental property of the linear dynamic model okay so this system is observable and then I am just showing you one particular example if I my initial state is 0.1 and 1 and you know u0 is this and you can uniquely estimate these are all dimensionless variables so you can uniquely estimate it is not just solving two linear algebraic equations you can recover whatever you want to it is not a problem okay now let us go back to the quadruple tank model okay quadruple tank model we had four states right four levels there are two inputs and there are two measurements only two question is can I reconstruct all four can I estimate all four levels using only two level measurements okay this is the first question that I should answer so these are my matrices phi matrix is this gamma matrix is here because we had done earlier when we did linearization and if I actually see now my observatory matrix what is n is 4 okay so I have to check C, C5, C5 square okay in MATLAB there is a command called OBSV observability OBSV okay you just give phi matrix and C matrix it will reconstruct this whole matrix and give you back it will stack and it will give you back this matrix so you can check the rank for this particular matrix the rank happens to be 4 which means I can fundamentally estimate you can do an experiment here you just try what happens if you take only one level measurement out of 4 and see whether the rank comes out to be 4 can you estimate all four states just using one level measurements why do you want to make such decisions well level measurement costs each level measurement is 50,000 okay so I want to add minimal number of level sensors why should I add too many right that is where I need to decide what is the minimum number so if I put 2 I get this rank to be 4 which means I can estimate so I am guaranteed okay so this is the most ideal scenario no noise only error is in the initial state okay let us slowly start relaxing these conditions one by one okay now what if there are errors in the measurement next question see this perfect recovery of perfect recovery was possible because there are no errors in the measurement okay so only error was only thing that was unknown was x0 but if there was an erroneous measurement then you cannot use just n equations and solve okay then you have to pose the problem as a least squares problem what is the best estimate I can you can construct because every measurement has an error okay so then I cannot just go back and use n equations because if I use you know for the CSTR problem if there is error in the measurement if you use first two equations you will get one estimate of x0 if you use next two equations you will get another estimate use third equation you will get third estimate that is because there are errors in the measurement measurements are not perfect and that is the reality every time you never get a perfect measurement you always get erroneous measurements so what if y is something like this y true plus some error okay and this is my measurement noise then what you are saying should be done you know we should collect more number of measurements and then try to consider least square estimate of x0 okay that is the best way of going about so what we can do here is we can minimize some of the square of errors okay what is done here is v is a vector of measurement errors r is covariance of this measurement errors I am just normalizing these errors using covariance inverse okay I am normalizing this errors with covariance inverse I do not know the true value of y that is the problem I only have the measurement measured value of y so I can only concept the best estimate okay you will never know in this case but this is a model proposed what is the model true plus error okay now if you have if now we can look at v as a stochastic process we can say it is a white noise a 0 mean white noise with some covariance covariance r okay in that case what I can do is now here I am trying to construct an objective function which is some of the square of errors okay let me just write down this what is this see this vk okay is let us assume it to be a white noise okay suppose there are 3 sensors okay there are 3 sensors then I will say that covariance of vk sigma 1 square 0 0 0 sigma 2 square sigma 3 square let us assume that vk is a white noise okay such that expected value of vk is equal to 0 expected value of vk is equal to 0 okay and each one of them has variance equal to sigma i square okay so what will be this matrix see this is my Q this is my r matrix what will be r inverse 1 by sigma 1 square 1 by sigma 2 square 1 by sigma 3 square 0 0 right okay and what will be this vk transpose r inverse vk this will be just take this vk 1 first component square by sigma 1 square plus vk 2 square by sigma 2 square plus vk 3 square by sigma 3 square so what am I doing here I am normalizing each one of the errors using its own standard deviation or variance okay why this kind of a thing is done that is because each measurement may have different accuracy also each measurement might be different type you know you may have pressure measurement level measurement see v1 could be pressure measurement v2 could be level measurement v3 could be temperature measurement and they have different units different variability so I want to minimize I want to minimize some kind of normalized objective function and that is the reason I use this information of variance I use this information of variance to normalize my objective function it should not happen that one of these variables because of its numerically large value it should not dominate my objective my optimization problem okay that is why I need some kind of normalization and that is why I am using information about the variance okay remember we are again revisiting stochastic processes here vk is modeled as a stochastic process 0 mean white noise 0 mean white noise with covariance equal to r it is a model proposed for measurement errors okay white noise means random error okay you can if you want distribution you can say normally distributed random error okay and then you are using that to normalize your objective function now you can solve this problem as a least square estimation problem that means I want to I want to estimate x hat not okay subject to this equation if you look at here what I have done is this part actually this part comes from here this part comes from here I have written y at any time k in terms of yk-u okay that is what I have done I have just used that particular information so this kind of recursive relationship I have used and then I have come to this okay I have just expressed my y I have just expressed my y true in terms of initial guess for x0 and all the known inputs that is all I have done are you clear about this y true is if see if you knew x hat true y true will be obtained through the model equations right model is giving this y true giving an estimate of y true actually when you get data you will never come to know what is y true you will only data will only give you y true plus error because you will never come to know you can only estimate error you can only estimate y true okay we will actually talk about this more detail you can only say that statistically you know if you collect large number of samples you might approach the truth you will never be able to recover from a sample the truth okay this difference is nothing but yk-y true k y true k is expressed using the model equations recursive use of model equations but the model y true will depend upon x0 and you and I have shown you that okay so I am just using it as a constraint optimization problem no jumping right now model is perfect what I must do model mismatch will see you do not ask a question in the 10 standard when you start looking at the first standard okay suppose there is no model mismatch right now usually it is the case usually the measurement noise is wide I can show you lab data I showed you what lab data you go back and look at temperature data which I have put in the system identification notes each one of them will have a wide place errors in the measurement are arising from see the fundamentally when you have a randomness coming from large number of sources each having a different distribution the random error that occurs tends to be with a random noise with Gaussian distribution this is central limit theorem okay so when you have a measurement noise it is arising from large number of things electrical fluctuations conversion error between unlock to digital you know it is something it is picking up on the way transmission line disturbance is everything put together what you get is a random disturbance which is like Gaussian in fact it turns out to be Gaussian white noise measurement noise Gaussian white noise model is many times more than sufficient for large number of cases they might be some 5% cases which are pathological but we are right now worried about 95% of the cases which are you know measurement noise is not you take sensors put them with this thing to be at constant this thing measure it you can estimate if you know I am taking temperature measurement I can independently estimate what is the temperature inside the tank and then I can take the measurements find out a difference I will get the error I can get an estimate there are different ways of doing it it is not you can any other doubt okay now this particular formulation even though it appears it is quite logical to go this way it is inconvenient what will happen if you start using this online the size of the problem will start growing okay see because as time advances you have 100 measurements 101 measurements 102 measurements so you go on starting a problem which is of increasing size okay and where do you stop how many you take from these square estimation theory you know that you take more measurements better it is okay but increasing solving this problem with more and more number of measurements as time progresses if you want to solve this every time it is not convenient so you need some better ways of doing this okay so that is why we are going to look at so called recursive estimators okay so anyway I will just give you an example before I move on let us say you have this 5 measurements which are you know or 6 temperature measurements which are noisy then you will get a v square estimator estimate you will not be able to recover the exact truth you will be going close to the truth so you get here 0.1 and 0.924 so the main problem with using this kind of a thing this is just a demonstration using a batch of 5 data points but 5 will become 6 6 will become 7 in a real time if you want to use this optimization formulation it is not practical so you need some other way of doing it okay so I want a recursive estimator I want a recursive estimator okay so what I am going to do is I am going to run my model online okay whatever input that goes to the plant I am going to fit it to my model okay and so this is the true process okay and this is my estimator which is running in my computer online okay so when the process starts at the same time I start running my model in parallel on the computer okay whatever input goes to the plant I am giving it to my model okay now let us ask the first question that I forget about all that optimization formulation and all that I am using this observer let me call this as estimator what I am doing is I am just feeding in whatever you that goes to the plant I give it to the model okay will the question is will this xk tend to x true will it tend to x true okay I have given a guess for x0 I have given a guess for x0 so initially at least for some time the way this is behaving and where this is behaving is going to be different eventually I wanted to merge okay let us see whether it happens online okay so what is the error just find out the error just go back and find out this error what is the dynamics of this error subtract the two equations just see what you get subtract equation 2 from equation 1 subtract equation 2 from equation 1 what do you get pardon me not why right now I am just asking you to subtract 2 from 1 I am just asking you to subtract 2 from 1 okay so if I subtract only the state dynamics okay I am defining this error x true minus x hat okay this is my error then I get this difference equation I get this difference equation linear difference equation and is everyone comfortable with this you know at time k if you just repeatedly use this difference equation you will get this solution okay under what condition error will go to 0 if eigenvalues of phi are inside the unit circle if eigenvalues of phi are inside the unit circle if you are running the model in parallel to the plant after some time even if you are given initial guess wrong okay the error will go to 0 asymptotically okay error will go to 0 asymptotically so this is very critical but what happens if plant is marginally stable or unstable there are many situations where plant is not exactly stable then this idea of running the model in parallel to the plant will not work okay this idea of running the model you need to do something else okay you need to make sure that so you cannot use this idea for marginally stable or unstable systems okay this simplistic idea will work only in the neighborhood of a point where the system has stable dynamics okay so what about the fact how fast or how slowly this will converge see it might take long time to converge I want convergence to occur quickly I want to start watching what is happening see my startup of the plant is a critical phase I do not want to wait for a long time till my error converges and I start see getting an estimate of what is happening inside I want a quick estimate so I should somehow make it happen faster what is the way out okay so we design what is called as a closed loop observer whatever we have done till now running the model parallel to the plant I am going to call it open loop observer okay I am going to use some feedback information I am going to give a feedback from the measurements of y to my estimator okay and then accelerate the convergence that is what I want to do okay so the idea is this I have a measurement see I am estimating states using my model which is running in parallel to the plant okay process is running okay I get measurement yk I can estimate what would be yk okay I can find the difference between the two and use it as a feedback correction so this error between y measured and y estimated this is called as innovation this innovation is used to correct the estimator so I can use this idea of feedback to stabilize or to make the dynamics faster in control why do you use a controller what is the reason you use controller 1 to 1 of the reasons why you use controller is because see suppose you have to do things in open loop okay plant is stable and you want to take the system from one state to the other state in open loop you give some change it will take its own time sweet time to reach that okay I do not want that to happen I want to take it to a new state very quickly okay that is where the controller plays a role in doing it fast that is why you design a controller which is optimal which takes it fast and so on. So one of the reason why you put a controller is to alter the dynamics you want to make it fast you want to make it slow you want to meddle with the dynamics same thing I want to do here I want to meddle with the estimator dynamics that is why I am going to put a feedback what is done in feedback control you put a feedback loop and you manipulate other reason why you put a feedback controller is plant is open loop unstable you put a feedback loop and you can stabilize it all of you know this right you can stabilize the plant is a feedback loop you can alter the poles you can alter the closed loop dynamics and make it faster or slower using same idea is going to be used in observer design okay so what is going to be my strategy. So my observer now is going to have one more term here okay I am adding one more term here l times ek what is ek is y measured minus y estimated y hat k is everyone with me on this y hat k is c times x hat k okay y measured if I use this what is l is a gain just like proportional gain which you use in the feedback control loop this is a gain matrix I am going to use this gain matrix to tweak the stability or performance of the observer okay so this is a feedback correction this is estimation error it is also sometimes called innovation okay the process is still like this okay we are taking the deterministic case right now I am still working with no noise okay no disturbances perfect measurements I want to use this scenario now what I should do is how does error behave now I have added one more thing here okay what is the dynamics of the error can you derive this subtract this equation from this equation just find out the state dynamics what is it what is the new state dynamics just remember that this y can be written as cx y can be written as cx okay when you subtract from this equation this estimator equation uk term will cancel just try doing it you would not understand unless you work it out I will show you the result what is the estimation error dynamics how do you choose that l matrix is going to be the you know how do I know next few lectures are just devoted to the you know problem of how do I optimally choose l okay so that I can influence the dynamics that is the you know that is what we are going to look at for next four lectures first of all PID controller now you forget about we are now talking about general state feedback controller so l is some gain matrix it could be MIMO it need not be PID single input single output I am not any longer worried about single input single output l is a gain matrix which could be non-square in typically what is the dimension of l matrix tell me x is the number of states okay y is number of measurements what will the dimension of l matrix number of states cross number of measurements if there are 100 states and 10 measurements l will be a 100 cross 10 matrix okay for the reactor l will be a 2 cross 1 because there are two states one measurement okay so I have to I have to find out if it if there are 100 states and 10 measurements I have to find out 100 cross 10 elements it is not same as designing a PID controller there are three parameters okay I have to work with 100 cross 10 I have to estimate 100 cross 10 elements so it is much more complex problem than PID controller design yeah but right now we will not worry about it so again you know do not jump this understand basics first then you can talk about derivatives what is the equation ? – lc okay so you should get if I do if I define estimation error like this then I get this error equation that is error at time k plus 1 will be function of error at time k through this coupling fix this lc okay now what is between the previous case and this case now in open loop I did not have any handle on how fast error changes now I have a handle to enhance the rate of convergence what is that handle I can choose L matrix okay how should I choose L matrix what should be the primary criteria eigenvalues of ? – lc should be inside the unit circle what can you say if eigenvalues are close to 1 there all the eigenvalues are close to 1 it will be slow it will take longer time for the error to go to 0 what if the eigenvalues are close to 0 it will converge faster so you have a choice now you have a choice and you should be able to dictate the speed of convergence by appropriate choice of L okay also there is one more thing if ? has ? is open loop unstable okay I can choose ? – lc to be inside unit circle so that even if the plant is unstable okay this observer will not be unstable observer will be stable okay you will get estimated states to be you know the error between the true and estimate will asymptotically go to 0 even if the plant is unstable that is what you can guarantee through the choice of this matrix okay yeah what is large L yeah so here you want the error to come to this thing very fast it may have some influence on how the closed loop behaves that yeah not unstable L unstable ? right hand poles no if it is no I am choosing L no I will never let a choice of L such that it is eigenvalues are outside unit circle by nil potent no but why you are only worried about degenerate cases right now that is a degenerate case fine so I can talk about fixes for those cases but not when you are not in 101 right if you have that problem we can discuss that later okay what you do for nil potent ? so in general for a normal ? which is either stable or unstable if it is stable you can enhance the rate of convergence if it is unstable you can so you are talking about things like which are detectable but not observable there are so many niceties which I am not going to talk in the first time introducing this concept right okay so this is my first criteria I want eigenvalues of ?-lc to be inside the unit circle okay and if that happens then error will go to 0 now what is very very important is that the error will go to 0 if you choose L such that this condition is satisfied okay error will go to 0 irrespective of what is the initial guess that you give you make a completely wrong guess does not matter okay as long as this condition is satisfied whatever initial guess you do error will go to 0 after some time how fast how slowly will decide upon what is this what is the eigenvalues that you choose okay choice of eigenvalues will decide the rate of convergence of okay so this is this last thing is very very important irrespective of choice of x0 it will go to 0 okay so my problem is how do I choose how do I choose this L matrix okay such that it has desired pole locations okay so I am going to this is a design problem now I am going to specify where the poles of ?-lc should lie and I want to back calculate L okay I know I know ? I know L okay sorry I know C I know C I do not know L I want to estimate I want to estimate L given the poles given the poles okay question is when can you do that okay now if you specify poles of a system how many poles you can specify n what is the dimension of this matrix ?-lc what is dimension of just write down what is dimension of ? matrix n cross n there are n states what is dimension of what is dimension of L matrix n cross if there are r measurements n cross r and what is the dimension of C matrix r cross n okay so what is the dimension of this matrix ?-lc n by n it is n by n matrix how many eigenvalues it has it has n eigenvalues okay so if you specify n eigenvalues how many equations you are giving n equations okay in general how many elements L will have n by r there are n by r elements of L and you are just giving n equations right can you solve it when can you solve it uniquely r is equal to e is saying r is equal to 1 do you agree when can you solve uniquely unique way of number of equations equal to number of unknowns okay when will it happen r is equal to 1 when only one measurement is there you have n equations okay r will have there is only one measurement matrix L will be n cross 1 okay the n cross 1 and then you can you have any equations in n unknowns you can solve it uniquely and you can get okay so how do you choose this poles is a very difficult question because if you if you choose them very close to 0 your you know observer brings error very close to 0 very quickly provided there are no errors in the measurement there are no disturbances there are errors in the measurement okay then observer which is trying to bring the observation error very close to 0 very quickly okay can give you trouble okay so when there are errors in the measurement how do you choose what should be the pole locations is not an easy task but nevertheless let us look at this problem of estimating the states the choice of poles is not a very trivial thing but now let us look at it as a mathematical problem because why we are doing to do this is because it is one of the fundamental ideas in control observer designed by pole placement and even though it might be difficult to use many times in practice it still marks a very important landmark in the development of observers okay so how do you choose the poles is a question that will keep it aside for the time being let us say we have some way of choosing the poles I am going to say well I know that placing the poles close to 1 will make it very slow keeping them close to 0 will make it very fast but my it might be sensitive to noise let us take a choice you want to put it at 0.5 neither at this end nor at that end okay so we are going to make it place all the poles at 0.5, 0.6 somewhere in between so we have some way of choosing the poles and now the question is how do I design the observer okay so let me just go back here for a moment and then okay so this y-lc so this is n x n this is n x r and this is r x n so together this is n x n so this whole matrix is n x n okay the next thing is that l is a n x r matrix okay so you know so this will be say l 1 1 1 2 l 1 n l sorry l n 1 this is 2 1 this is l 2 1 this is l n 1 l 1 2 l 2 2 n 2 and so on and so you will get l 1 r up to l n r okay there are so many unknowns there are so many unknowns in this matrix okay and what I am going to do is I am going to say that phi-lc so I am going to put zi- okay let me move to the other paper I am going to say that determinant of say zi-phi-lc equal to 0 okay this is the characteristic equation okay and I am going to specify poles of this I am going to specify roots of this okay how many roots I can specify I can specify only n roots this is the nth order polynomial I can only specify n roots okay so let us say I am going to say that roots of this are at z1 is equal to p1 z2 is equal to p2 and so on I am going to give some pole locations say 0.5 0.5 0.5 let us take a very simple choice neither 0 nor 1 somewhere in between okay I have given this choice okay if I give this choice okay if I give this choice and if I write the equations this poles of this or the characteristic equation here will be function of this l right so this will be function of l11, l12, l13 and so on right so it will be some very complex function of l11, l12 and I can do a very you know crude job of actually expressing this in terms of l11, l12 finding out its eigenvalues and saying it equal to p1 equal to p2 okay if I do it very crudely okay it can become very very difficult the question is if I want to specify the poles okay of this matrix to be equal to p1, p2, p3, p4 okay can I do some elegant algebra okay can I do some elegant algebra such that I can do it easily I do not want to actually sit and solve this equation I will get some very complex function of l11, l12, l13 and all that okay and then equating and solving those coupled equation can become very messy okay if you try to do it for general n dimensional case okay it can become very very messy if you actually solve this equation raw form okay so I want to do some very nice linear algebra such that I do not have to sit and solve this equation by hand okay so what is this elegant algebra that you want to do is everyone with me on this is there any doubt here what I want to do I want to choose elements of l such that the poles of this roots of this equation are equal to you cannot even write roots of this equation analytically can you write you cannot write analytical expressions for that okay so saying that it is equal to something and solving it is very difficult okay if you just try to do it as a raw problem okay it will be very difficult to even formulate and solve this problem as a raw problem of equating you know poles finding out l11, l12, l13 and all that so it is not very easy to do this if you just think it is a raw form okay so what I am going to do is I am going to do a variable transformation this is where linear algebra will help me okay so I am going to do a variable transformation I am going to transform from x to a new state variable neta okay first of all I am assuming that there is only one measurement okay if there is one measurement then l matrix has only n unknowns okay l matrix is a vector n cross one vector okay I want to estimate elements of this vector okay so this is my model this is my original model okay and this is the transfer function right now I am going to use that trick of sometime back we talked about some canonical forms do you remember canonical forms controllable canonical form observable canonical form talked about those canonical forms right I am going to convert this model into the canonical form how do you convert into canonical form if you look at if you look at the transfer function you can write the canonical form what is the advantage of canonical form the advantage of canonical form is that the characteristic polynomial coefficients appear as the first column right the characteristic polynomial will appear as the first column okay see this kind of a nice thing is not available when I have general file right when I transform it into this particular form okay when I transform it into this particular form I get a1 a2 lined up on the first column then this part is 1 0 0 0 1 0 okay so so I am going to use this particular form to simplify my pole placement pole placement means I want to choose l1 l2 l3 l4 observer gain in such a way that the error dynamics has poles at a desired location okay so instead of working with this I am going to work with this transformation okay so my trick is going to be like this I start from here I transform it into this form these are inter convertible we know that okay these two are forms are inter convertible so this is only a different way of representing the system okay I am going to design an observer for this system okay and then this two are related through this transformation so I am going to come back and from the transform domain I am going to come back to the original domain and use that observer okay that is going to be the trick is everyone with me on this transformation this we have done earlier in the class only thing is in a different context I am now the question is how do you go from here to here okay I will answer that question right now just wait for five minutes to come to that point okay so my design procedure is like this I want to transform the model to the observable canonical form once I do that design an observer for the transform model okay and then express the observer in the original state space model using the inverse transformation so transform the problem design the observer do inverse transformation okay that is a trick why you can do this you know linear algebra allows you to play with the model in the model space you can do all kinds of things when you have you know linear difference equation model okay so let us see what we are going to do this is my transformed observer this is my transformed observer I am designing an observer for the transform system okay can you derive this equation can you see whether you can derive this equation just go back just go back here just go back here and try to design the observer equation for this just go back and check what will be what will be ?a-ca see understand what I am doing what I am doing is I am first transforming this to this form okay and then I am going to design an observer in the transform domain okay I have to design an observer in the transform domain can you derive this matrix just check can you derive this matrix how will you get this matrix what is C for this particular system for the transform system Cca happens to be 10000 it is very nice okay so see my transform system is and then I want to design an observer which is I want to design observer like this okay I want to design observer like this observer will be in the transform domain okay what is this L it is only the dimension of y is only one there is only one measurement okay what will be dimension of L L will be n cross 1 okay so for the transform domain ?a-lca is nothing but ?a- what is L L will be L1 L2 up to Ln what is C 10000 okay and what is this ?a ?a is-a1-a2-an 1000010 and so on we are working in a transform domain transform domain this transform ? is very nice only one column only one column is there which corresponds to the characteristic equation itself all the other elements are 0 and 1 okay the transform model is very nice looking okay so now when I take subtract this from this see what is multiplication of this what will you get see this will be this will be just L1 L2 Ln 0000000 it is a special form and that is why you get this in the transform domain okay now what do you what is the advantage can you tell me from here what is the column signify poles of the what is the column in observable canonical form what is the column signify questions of the characteristic equation of which which characteristic equation so the characteristic equation of Zi-lca- ?a okay or ?a- whatever what is the negative okay for the transform part for the transform part the first column will actually tell you first column will actually give you the characteristic equation for the closed loop directly just looking at this you can tell what is the characteristic equation of the closed loop okay so this is my characteristic equation I can just look at this form and write the characteristic equation which is very nice okay and then I will just say that my closed loop should be equal to okay specifying poles is equivalent to specifying another characteristic equation so I am going to say that this characteristic equation should be equal to design characteristic equation this is my design characteristic equation okay this has the poles at location where I want I am just going to equate the coefficients of this and this okay if I equate the coefficients I get the design for the observer so if I just equate the coefficients okay I will get so this polynomial is what I have specified it has roots at the desired location where I want this is the transform polynomial I just equate the coefficient I get the observer designed in the transform domain okay I have designed the observer in the transform domain so I should come back to the original domain I have gone from x to neta I have designed the observer for neta I should recover this is one more thing which we have seen earlier variable transformation it does not change poles we have seen this earlier I have shown this in the while developing state space models just go back and look at what we have done in the state realization part okay everything that we have done has a relevance okay just it is not done without purpose if you design in the transform domain and come back to the original domain the poles do not change okay the form changes it is not that the fundamental characteristic changes when you transform so I am going to design the observer in the transform domain and then I am just going to come back to the original domain using the transformation matrix T now the question is how do you get this T okay not very difficult T is just multiplication of you know two observability matrices you take the observability matrix which is original you take the observability matrix for the transform system and inverse of this times original observability matrix gives me the transformation matrix okay this derivation is very simple I am just leaving it to you I am not doing this derivation it is very very simple you can just show that observability matrix of the transformation can be obtained through observability matrix well you know see you are given the system so you know C you know C phi you know everything here do you know this matrix you know this matrix also because you have transformed see you are able to transform and you know what is the characteristic equation see this C A and phi A has specially very simple form what is the simple form of phi A and C A phi A is just find a transfer function write the coefficients of the denominator here write 1 0 0 okay what is C here 1 0 0 so this is once you find from here to here writing this form is very very easy not at all difficult okay so for this system if you want to find out the observability matrix it is very easy okay you just you can just you can just find a transfer function construct this form write the observability matrix you are given phi and C finding the observability matrix for this system is very easy it is not difficult okay so finding the transformation matrix is but then this particular equation has a very very important message it also tells you that you can do this transformation only when the observability matrix is invertible or it has rank n okay so observability and ability to place the poles at any location are linked you can place the poles of the observer at any location you want provided the system is observable otherwise you cannot do it okay so these are deeply linked concept observability is not just a mathematical idea which we tried to okay so this is equal to n you are guaranteed that you can place the poles at wherever you want okay I will just go to this CSTR example we have this system okay I converted this into the observable canonical form okay I can convert this into observable canonical form formula for doing this I have already given you T matrix T matrix is constructed in a particular way you can construct T matrix without any difficulty once you find a transfer function for the system you convert this into observable canonical form you place the poles okay in the transform domain okay and recover the observer in the original domain okay so just to summarize okay so we started from x k plus one is equal to phi x k plus gamma u k and y k is equal to C x k we transform this to neta x k is equal to phi a neta k plus gamma u k y k is equal to C neta k then we designed an observer for neta hat k okay by placing poles for of phi a minus sorry this is C a and this is gamma a these are transformed so phi a minus l let us call this l a C a we place the poles we place the poles of this matrix okay and we designed this l a and then from this we recover l in okay so we found out this l a from l a we can recover l okay and the fact that if you move from one transformation to other transformation it does not change the eigenvalue helps you in making sure that even if you have place the poles of this okay that ensures that this system also error dynamics will have same poles because transforming variables does not change the pole locations that is the fundamental idea okay so that is how that is how this thing works okay so here I have gone to the transform domain I have gone to the transform domain in the transform domain I do the pole placement do the observer and I come back and find out recover t using t I recover my observer in the original domain I do not want to work with the transform domain I want to work with x1 x2 ultimately I want to estimate concentration see here x has a physical meaning concentration and temperature in the transform domain physical meaning is lost okay but it is convenient to design so I design in the transform domain and come back to the original domain because I want to ultimately talk not in terms of neta 1 neta 2 I want to observer for temperature and concentration that is why I come back okay how good is this observer I am just comparing the open loop observer no l with l okay for this reactor problem this is the open loop observer no l after some time obviously you know this estimate and the truth converges okay open loop stable system no problem okay I want to make it fast by pole placement okay the error converges like this if I put poles at 0.5 oh yeah just a demonstration here look here this is open loop observer there is a mismatch between the initials true state and the estimated state okay the true state is this black line estimated state is this plus open loop observer open loop stable system after some time error between this will go to 0 okay it is not fast enough I do not want to wait for you know 10 minutes or 5 minutes for this to occur okay I want the error convergence very fast what if I design this is the error dynamics between true and estimated it goes like this what if I design an observer pole placement weenberger observer at 0.5 why it is called weenberger observer because weenberger develop this whole theory one of the grand old man of control theory so just look at here okay if I place the poles at 0.5 I am able to take error to 0 very very fast okay how fast just 2-3 samples this figure speak for themselves okay you place the poles error goes to 0 very fast okay and you are able to use the observer online for estimating the concentration okay using the so this is my estimated concentration this is my estimated concentration plus using open loop observer this is my estimated concentration in reality you will never know the truth but what I know is that estimate of the concentration goes to the true value very quickly in this particular case using weenberger observer okay so that is how I can control the error dynamics by placing the poles so we will continue this right now we are not look at noise we are not look at disturbances and the life is going to be more complex when we start looking at noise and disturbances okay so please bring the notes because the next 3 lectures I am going to talk about the celebrated kalman filter okay it is difficult okay to understand so please bring the notes you will need those notes to make extra.