 Let us take a quick review of what we have done in the previous lecture and then we will take it forward to model development which are control relevant. If I put it in abstract form what we have discussed, ordinary differential equations X are the states or X are dependent variables U and D represent inputs independent inputs U represent manipulated variables D represent disturbances Y here are measured outputs. Now I am using this notation here Y belong Rn which means X is a vector which is n dimensional U is a vector which is m dimensional R is a vector Y is a vector measurements are R dimension there are R measurements there are n states there are m inputs and there are D disturbances. So we are looking at a system which is multi variable in general okay then we want to have a local perturbation model this local perturbation model is developed in the neighborhood of some steady state operating point this is denoted here by X bar U bar D bar well if you notice here I am using capital letters to denote all the variables capital letters here indicate that these are absolute values okay we will move on to deviation variables I will start using small letters for deviation variables so these are absolute values and then I want to do multi variable tell the series expansion in the neighborhood of the operating point okay the first question is bar these are dependent variables independent inputs are only disturbances and manipulated variables okay if I specify levels of U bar and D bar using the non-linear differential equation I can solve for the steady state I can solve for f of X bar U bar D bar equal to 0 I do this using Newton Raphson method or Newton's method or some iterative method for solving non-linear algebraic equations steady state is nothing but when you convert this differential equation and view it at steady state you have a set of non-linear algebraic equations which have to be solved simultaneously. So that can be just done using standard techniques for non-linear equation solving and then for given D bar and U bar you can find out X bar this is using a well known method such as Newton's method having found X bar U bar D bar we want to use multi variable tell the series expansion so what is this multi variable tell a series expansion this is my multi variable tell a series expansion I am going to expand the right hand side I am going to expand the right hand side in the neighborhood of X bar U bar and D bar okay now here f is a function vector f is a vector of functions we know what it is partial derivative of with respect to X is going to be a matrix it is going to be a matrix what is the dimension of this matrix f is a function vector there are n functions n differential equations and X has a dimension n it will be n x n this will be n x n mind you when you write this equation you have to be very very careful about the order in which variables appear I cannot write X t minus X bar I cannot change this order of I cannot change order of this matrix and this vector this is a vector this is a matrix okay so matrix times vector it has to be that way you cannot even for even by mistake change the order what is the meaning of this X bar U bar D bar written here it means partial derivatives are yeah evaluated at X bar U bar D bar once you fix this X bar U bar D bar and once you evaluate this partial derivatives at a particular point this is a constant matrix okay same is the case with doh f by doh u doh f by doh u is derivative of function vector with respect to inputs this is a matrix which is n x m and you have a matrix which is n x d which is doh f by doh d so there are two there are three terms appearing here two because of inputs one because of the state itself just look at this equation it tells you that this is not a algebraic equation this is a differential equation a differential equation has a memory of past okay if you try to analyze the terms in this equation it has three terms okay on the right hand side it says that the current derivative current rate of change is function of what has happened in the past where does the past information come from X is the past information okay whatever has happened from time 0 to current time t is getting captured through xt or xt minus X bar in this case perturbation what is happening new what is the new input that is coming in that is U and t okay so it just says that rate of change of X or perturbations in or small perturbations in X is governed by this particular equation equation to I have just written the steady state equation I am going to subtract basically at steady state we know that f of X bar U bar d bar is 0 okay so actually you are subtracting 0 from both sides but I am subtracting equation one from equation two okay and I will get the perturbation model I will get a perturbation which is X minus X bar okay when I subtract this equation from this equation f will vanish from both sides okay on the left hand side I will get X minus X bar okay and right hand side will be again X minus X bar U minus U bar and D minus D U bar this term will vanish when I subtract okay in the same way I am going to linearize the map or the measurement model measurement model is Y are measured variables which are some functions of states okay I have taken the most general case where G is some non-linear function okay and I am developing a perturbation models so small yt is a perturbation from the steady state Y bar which is given by dou G by dou X dou G by dou X will be a vector which is r cross n there are n states I have just given these equations these matrices here for your convenience so these are n cross n n cross m n cross d and r cross n matrices these are evaluated at the steady state operating point so once you evaluate them at a particular operating point you have fixed matrices okay so I am going to it is inconvenient to work with those dou X dou F by dou X and all that I am going to switch to a simplified notation ABTD you open any text book and control they actually start with this model they do not tell you how you got this model they just start with this model X dot is equal to ax plus bu plus hd and so on so but actually these are perturbation variables the small perturbations in neighborhood of the operating point and the connection with the models that come from physics that you know from your engineering background is actually through Taylor series expansion linear approximation local approximation and so on okay so as far as controller design is concerned I am going to use this simplified local linear model why linear differentiations were very well understood even if they are multivariable I can solve them I can manipulate them I can play with them you can solve them analytically okay and that is going to be the strength when you develop linear control theory well what is my aim ultimately what is what is the aim of control get to the set point somebody else can tempt safety okay I will put it in little more abstract term I want to shape the dynamics okay I want to shape the dynamics the way I want sometimes I want to maintain at certain point sometimes I want to move from a point a to point b right where is the trouble here in this equation one trouble is disturbance okay one trouble is disturbance what is it that you have in your hand is you so I want to shape I want to choose you in such a way that output y has a desired transient behavior okay so I want to manipulate and if I want to manipulate I should be able to you know turn around this equation the way I want that is possible very I mean that becomes very easy when you are differential equations it is not that you cannot do it with nonlinear differential equations well for us to go there would take at least two more courses to reach the point where we start looking at nonlinear differential equation manipulations ES we cannot many times capture H so I will be actually dealing with it much more elaborately in next few lectures so right now what I am saying is that see in this particular case assumption is that you have a good model coming from physics availability in that case I can find out H matrix okay well when you do not have a model what you do will answer that question later right now we are considering a scenario where you have a good first principle model you have a good mechanistic model and this is possible for some systems see it is not that I mean some systems in say robotics okay when is the equations that come from mechanics can be written quite precisely okay so it is not that I mean this course the way we are going to go about is not related to any particular domain though it says advance process control you know it is advanced control of course so in some cases you have these models in some cases you can write those you can find out H matrix starting from mechanistic model okay well we have seen this matrix for quadruple tank setup and then actually this is the steady state operating conditions which I have put them on the corner right corner the steady state y bar and u bar is nothing but four levels and two inputs which are given there okay and if I actually linearize substitute values I get these three matrices ABC there is no H there is no disturbance consider right now so there are three matrices that we get and then we said well we can actually convert this into a transfer function matrix I just wanted to map this to a transfer function matrix the model that we have is actually as this model that we have got here is called as a state space model okay it is a linear differential equation it tells you something about what is happening inside through the states okay but all the states may not be measured in this particular case out of four levels only two levels are measured okay so we know we know here this model is more powerful than the input output model tells you something about things that are not measured now the next thing is you know you know is through Laplace transforms if I assume that initiative 0 and if I take Laplace transforms we did this last time we get this transfer function matrix y which relates to u and to d and for this particular case I calculated a transfer function matrix this turns out to be this two cross two matrix two level measured h1 h2 to level lower levels and two voltage inputs you can see the transfer function matrix tells you that level one is affected by both you know v1 and v2 level two is affected by both u1 and v2 okay matrix is full in reality when you go to a complex system you will have many measurements you will have many inputs and typically the matrix will not be you know diagonal it will be full many things affect many things it is very difficult to find a system in which only one input affects only one output very very rare okay and we started looking at this computer oriented models and we said we have to worry about two things one is measurements are sampled okay you have you know a regular interval at which the measurements are coming to a computer and I am going to denote them by yk that is my notation actually yk means measurement perturbation variable y available at time kt kt is k is the sampling instant I start from say 0 1 2 3 4 gap between two samples could be one second could be five seconds could be ten milliseconds depends upon the system which you are considering and then inputs I said are going to be piecewise constant that is because I am sending inputs my from my computer my computer can only generate sequence of numbers my computer cannot generate a continuous signal I need a device called as d2 a converter digital to unlock converter and this to unlock converter will reconstruct a continuous time signal a wall control wall or a stepper motor or whatever is your actuating element will receive a continuous signal it will not receive you know pulses or you will not receive impulses finite impulses it will receive a continuous time signal. So now I need to adjust my model to the reality that I have this differential equation and I want to develop a computer oriented model okay a computer oriented model which in which we convert the differential equation into a difference equation what kind of difference equation I want to hop in time okay I want to go from time instant 1 to 2 2 to 3 3 to 4 okay every time in my computer I am going to get one sample at you know let us say 5 seconds interval I want a model that relates what happened now to the next instant what happened in the next instant to instant after that okay so convert a differential equation into a difference equation what are the constraints or what is the at let us now let us not worry about time 0 let us look at a situation where we are standing at some sampling instant okay at current time okay and I want to I have the I know the state value at current time which is xk I am going to denote it as xk here this is a short term notation for x at time tk where tk is nothing but k times t capital T here is the sampling interval okay capital T here is sampling interval so sampling interval will depend upon how to choose the sampling interval is somewhat complex business and there is a theorem called Shannon sampling theorem which applied you can probably go back and read in the references that I have given I do not want to spend time on Shannon sampling theorem here but what is important I will tell you qualitatively you should sample fast enough so that you do not miss out the major features of your signal okay what is this you know from system to system it is different okay in a furnace which is very very slow it might be sufficient to sample every one minute you do not miss too much if you take furnace temperature measurement every one minute because furnace has a very slow dynamics okay automobile you need samples every you know 50 milliseconds or 100 milliseconds okay we were controlling a fuel cell we needed samples at 10 milliseconds so it depends upon what is it what is so this T could be you know whatever depending upon the system and as a engineer you have to take a call what should be the sampling interval okay so digital control system the signals arrive okay a measurement arrives at instant time kt and input is sent out at to the system at time kt so let us call it instant k sampling instant k so I want to convert a differential equation into difference equation I am going to use a notation here xk is nothing but the state of the system at instant k okay it is a short hand notation yk is the output measurement at instant k uk is the input sent out to the plant at instant k okay now how do I convert well I want you to remember something that you are done in your first year of engineering remember integrating factors how do you integrate this differential so you take a xt on the left hand side then you have an integrating factor e to the power minus at right then you multiply both sides by integrating factor and then you integrate both the sides I am going to do the same thing except I have to do it for a vector differential equation okay so I need something I need something that is equivalent to an integrating factor but now I do not have a scalar in this equation I have just put here a scalar equation a is a scalar b is a scalar okay this is a very simple system it is very easy to integrate this differential equation all of you know how to do it I need to define something equivalent to an integrating factor I need something equivalent to this what is nice thing about e to the power at or e to the power t if you differentiate what will you get back it is a very nice it is a very nice signal continuous time signal if you differentiate e to the power t you will get back e to the power t okay I am going to introduce what is called as max matrix exponential now by analogy you can see how it is defined see the factor here one here is replaced by I identity matrix okay then you have a times t t is a scalar of course well it is convention to write it like this probably when you do scalar and matrix multiplication you should not write scalar after the matrix you should write t a but books sometimes write interchangeably okay now look at this newly introduced matrix exponential well let me tell you something e to the power at is defined as limit of this infinite sequence on the right hand side just like e to the power you know scalar at is defined as this is definition of e to the power at now I need to find out what is the derivative of this particular particular you know matrix exponential just take derivative on the right hand side okay you see what I have done here I can take out a and derivative of e to the power at turns out to be e to the power at minus a first of all do not forget e to the power at is a matrix even though we write it as e to the power at and e is a scalar e to the power at is a matrix the definition is I plus at times a square t square so this is a matrix so when I differentiate this I get e to the power at post multiplied by a matrix you cannot write pre-multiplied it is post multiplied by how am I going to use this okay now I am going to go the same way that what we do for the scalar case I am going to multiply both the sides by the integrating factor okay is everyone with me on this I am p multiplied by in this case you can actually in this case you can in my derivation it is convenient to write a in this particular case you can write a or either way well what I want to stress is when you probably I over stressed it when you deal with these things you have to be very very careful you know order order is not to be missed okay now I am rearranging this equation I have just taken e to the power at on the left hand side okay so the second step is everyone with me on this yeah and now I am going to integrate integrate from where to where I am standing at sampling instant k I am just worried about going from k to k plus 1 okay I just want to model that relates what is happening now with the next sampling instant okay that is all I am worried about so I am going to integrate from time k t to k plus 1 t t is of course the sampling interval okay now here the right hand side integral can be simplified because what we know is within the sampling interval my inputs are constant piecewise constant okay within the sampling interval my inputs are piecewise constant so I am able to take this u k t outside and then I only have to integrate e to the power a times b dt okay this integral I have to compute okay is everyone with me on this d of look at what is here this is d of this when I integrate this I will get I will get you know e to the power at x t I applied two limits I have skipped one in between step is anyone has doubt with this I have just applied two limits I have taken the integral applied two limits and moved one part to the right side okay yeah it is a tau yeah yeah that is a typo yeah please correct it this is e to the power a tau not at in the second term it is important it is quite important what you say is quite important okay now or either a tau or I have to change to dt either of the two okay I think changing to dt will help instead of changing everything to tau okay so is this step here okay I have just integrated the left hand side applied the two limits okay and rearrange right now what I am going to do is I am going to multiply both the sides by e to the power minus a k plus 1 t okay moment I do that see what remains here here it is minus a kt this is plus a k plus 1 t so the difference will be only e to the power at that is what remains okay here my integral changes to this is it okay I am just going slow because you should you know understand the steps is this clear yeah I am going to multiply plus a both sides now a to the power k plus 1 t k plus 1 is a fixed value so I can take it inside the integral without making any it is minus oh this should be oh there is one more typo here yeah you should have yeah in this in this equation I should have e to the power mine you should have minus a t that is better is that okay now yeah okay so far we have reached this point is this now consistent yeah so I need to integrate I need to find out e to the power capital a t I need to integrate this right hand side equation well now how do you do that I am going to do some change of variable I am changing I am defining tau as k plus 1 t minus small t so d tau will become minus d t and then with a little bit of algebra you can show that the integral can be changed to 0 to t e to the power a tau b d tau okay so with this with this particular modification you can change this to okay so nice thing about nice thing about these two matrices is that here and here k has disappeared okay this is only function of b a and sampling interval okay it is only function of b a and sampling interval so now I need to worry about I am going to define two more matrices phi and gamma okay and I am going to use this phi and gamma throughout to denote this linear difference equation model this is my linear difference equation model which is computer oriented computer relevant okay digital control relevant whatever you want to call it output map does not change there is no integration output map is a measurement map is a static map y t is equal to c times x t so y k at instant k is c times x k so that does not change I do not do anything for changing the measurement model I only have to change the differential equation into difference equation okay so this phi gamma matrices are defined as exponential e to the power a t where t is the sampling interval and gamma is this complex integral that we have listed here and we will now talk about how to compute these integrals well just a reminder that piecewise constant inputs it only holds for manipulated variables the disturbances are not piecewise constant what is going out of my computer is piecewise constant okay so developing a model for disturbances which are not really piecewise constant is a tricky business when it comes to computer oriented modeling we are going to look at it this tricky business but let me just pre-empt let me just say that it is not an easy task okay how do I compute lot of algebra I assume that all of you are familiar with this grand equation you can I am going to take a special case first then I will talk about how to do it for general case through another method why I am doing it this way is because many times it is easy to get some insights let us assume that matrix A that we get after linearization of non-linear differential equation let us assume that it is eigenvalues or it is eigenvectors are such that they are linearly independent if they are linearly independent you can diagonalize matrix matrix diagonalization is a very very powerful tool it is used all over in applied mathematics in engineering what I am going to do is I am going to A as matrix psi capital lambda psi inverse capital lambda is a diagonal matrix it has all the eigenvalues appearing on the diagonal okay psi is a matrix in which you keep eigenvectors next to each other this psi is a matrix in which this eigenvector is a column vector okay v1 is the column is a eigenvector for eigenvalue lambda 1 v2 is for lambda 2 there are n eigenvectors I am just keeping them next to each other this equation talks about diagonalization of matrix A okay is this clear it is okay I am going to use this equation to compute matrix exponential it makes it very very easy just a reminder what is scalar case okay this is my e to the power at I want to compute this I am going to just rewrite this is everyone with me on this what is a square see we have this so a square is psi lambda psi inverse into psi lambda psi inverse which is psi lambda square psi inverse okay so likewise I can write a to power n as psi lambda power n psi inverse okay this is a trick which I am going to use so this is the trick which I am going to use to convert I can just pull out psi and psi inverse I get this I plus this into you know the matrix inside the brackets is very nice why it is nice because lambda is a diagonal matrix okay lambda is a diagonal matrix so what is e to the power capital lambda t e to the power capital lambda t is nothing but I plus lambda t plus now look at this matrix if you actually compute this matrix okay look at this diagonal terms diagonal terms will be this is a diagonal matrix this is a diagonal matrix this is a diagonal matrix okay I am just combining that into one big matrix this one but matrix is one plus lambda one t plus lambda one square but this is nothing but e to the power lambda one right and so on so for each one of them that is e to the power lambda t so this is very nice so which means you know computing matrix exponential is not that difficult if you know Eigen values and Eigen vectors you just compute Eigen vectors you compute e to the power lambda t you are there well computing gamma once you know how to compute this computing gamma also becomes very easy okay is everyone clear about this is this fine any difficulties no okay so computing this matrix is inside matrix here the one inside this now once you have Eigen vectors decided this size is a constant matrix then computing these integrals is not at all difficult it is very very easy you just have to integrate each term separately I am talking about an alternate method of doing the same thing how do I get this phi gamma well I have this differential equation and I am going to now go through Laplace transforms okay I show how to do it in time domain let us also look at Laplace transform if you are comfortable with that okay take Laplace transforms on both sides okay the difference is when you take Laplace transform of a differential equation you will get x not okay what is x not in this case no it is not at time 0 it is at time k I am solving differential equation from time k to time k plus 1 so here instead of x0 I am getting xk we assume that x0 or 0 but xk is not equal to 0 I cannot ignore it okay I have to take it into consideration so this equation I have this xk appearing which cannot be ignored of course this brings in information about the past into the system okay how am I going to take a Laplace transform of u which is starting at time kt and going up to time k plus 1t okay I am modelled as a pulse I modelled as a pulse so pulse of duration t is entering the system okay so it is like a forward step and then a delayed step in the negative direction so you are starting from 0 going to uk coming back to uk minus 1 so that is how it is modelled okay so to go back to time domain I should take Laplace inverse and if I take this Laplace inverse I will get ? if I go to time domain from this equation I will get ? e to the power at is nothing but Laplace inverse of si minus a inverse okay si minus a inverse yeah that is because of pulse I am looking at input as a pulse square pulse okay and my gamma would be e to the power t integral 0 to t you have two integrals coming here into picture and then combined will give you this particular integral I will just show it for one particular example yeah yeah x of t you will get x at time you will get x of t and then you find out x at time k plus 1t okay I have skipped in between two three steps because you cannot go to that detail you know you have to fill in the blanks okay you will actually when you take Laplace inverse you will get x of t then you put t equal to k plus 1t and then you will get the next equation okay is that clear yeah okay let us take a simplified model this is a simple problem from Astrou and Wittenmark one of the bench one of the classical books in the control so let us not worry about what is x and what is y this is a DC motor model you know just look at the algebra that we want to learn now okay I want to compute ? so I should compute si minus a inverse now these kind of matrices probably you have not dealt some of you at least may not have dealt with earlier I am going to do algebra on these matrices as if elements are numbers okay. So how do you find out matrix inverse you take adjoint you take you know determinant I have done the same just look here this matrix si minus a inverse okay in fact you will notice lot of similarity with eigenvalue equation and si minus a what is eigenvalue how do you find eigenvalue ? i minus a okay so just keep that in mind they are not going to be turn out that they are same things okay so if I actually do this algebra of si minus a inverse for this particular matrix I will get this matrix here on the right hand side one upon and then I will take a Laplace inverse now how do you take Laplace inverse element by element you take Laplace inverse that is very easy if I do that Laplace inverse of that I will get this equation I choose one particular sampling interval T let us say one second point what can it is a DC motor maybe .001 second then I will get these elements you know right now I am not computed for a specific T but you will get this element this is how I compute this is a how I what about ? for ? what I do is I write a general expression for ? okay e to the power a T and then I integrate for integrate I will get this right hand side here is this clear is an example here this just go over it okay this is how I can compute now when you are going to do it actually the example system use this one of these whichever you are comfortable with but actually when we the main thing in this course is going to be you know using MATLAB programs and MATLAB you do not have to do all these equations writing is a MATLAB command called C2D continuous to discrete you just give matrix ABC matrices it will convert for you and will give you ? ? C you do not have to do any of these complex computations when it comes to a real big problem so yeah not KT K is gone see first of all ? and ? are not functions of K at all they are functions of only AB and sampling interval there see you will get only the difference you will get only the difference between the two time instances you will never get K itself I mean variant systems very very simple okay well when matrix A is invertible you can do this formula for ? okay so if A has linearly independent eigen vectors does not mean it is invertible it may have a zero eigen value it may not be invertible but if it has linearly independent eigen if it has all eigen values which are non zero then you have a simplified formula for computing ? okay quadruple time setup what I did of course is asked MATLAB to do this I just gave ABC matrices and MATLAB just gives me this through C2D I do not have to do bigger and bigger matrices you cannot start writing your own programs you just use MATLAB to convert I get these numbers this is a now I am to go and introduce something which is going to help me throughout the course I have to use some kind of transforms to denote to do some of the algebra that I need to do later on and for that I am going to use something called a shift operator a time shift operator Q is going to denote time shift operator okay now what are we considering here we are considering a discrete time signal okay a discrete time signal xk a discrete time signal xk is a collection of vectors I have put it in curly brackets okay so see when you write sin t where t goes from some you know 0 to some value or 0 to infinity what does it indicate does it indicate one value of the sin it indicates the entire function going for a time goes from 0 to infinity it is the entire time function from 0 to infinity in this case I am considering discrete time signals so I have to look at sequences I have to look at sequences these are sequences of vectors okay k is the index I have sequences of vectors I am going to define a shift operator Q okay Q is a time shift operator when Q is on x I will get one time in future you see this here when Q operates on this signal xk I will get signal xk plus 1 there is one okay so you get the shifted sequence in general when I operate okay so I shifted sequence I get a shifted sequence make this correction though it appears small conceptually means a lot okay so when Q operates Q is a shift operator you know I want to look at signals which are shifted in time now I am going to develop something called as a Q transfer function okay I am going to develop a Q transfer function why I need transfer functions you know progressively will become clear to you why I need transfer functions so xk plus 1 I am going to now skip writing curly braces okay it is understood we are dealing with sequences every time I am not going to write curly braces so I am going to taking a Q transform so xk plus 1 is nothing but Q times xk is this step clear with this definition xk plus 1 is Q times xk Q transform of xk is nothing but xk it is Q to the power 0 okay you are not shifting forward you are not shifting backward is the same sequence okay so this equation this equation I can rearrange as Q i minus 5 okay times xk okay is equal to gamma times uk okay and then y is equal to y is equal to c of xk I have just eliminated xk is Q i minus 5 inverse times uk I have just substituted that here okay I got this I got this equation which is between only input and output okay y is equal to gq into uk okay is this clear any doubts here no okay so this new animal is called as pulse transfer function pulse transfer function matrix we are going to deal with two different notations one is Q transform or Q operator shift operator and Z transforms and well we have to use both the reasons are different remember here I am still in time domain my signals are in time domain okay I have not gone to frequency domain when you do Laplace transform what happens you start working in frequency domain right Laplace transform you start working in frequency domain here this Q operator is only time shift operator I am shift I am just representing into time okay suppose I do not want I do not want to work with x I do not want internal variables state variables I just want to work with input and output okay I just want to look at major levels two voltages which are going to the full tank setup I am not I am not all four levels so I have got rid of you know the states now my model is only between measured outputs and okay now what does this Q how does it help me well in one lecture I am trying to pack too many concepts but well with some practice you will get what is if I do this if I do this calculations see I already have I already have five matrix I already have gamma matrix I have calculated that for quadruple tank setup so I can just do this calculation again MATLAB will help me do this calculations but for simple system two cross two system you can do it by hand it is not so difficult okay do you want to try this for the model that we derived maybe we should do that let us go back to the DC motor model so you have this phi and gamma do you want to try converting let us let us put this as you know phi equal to you know this is alpha 1 minus alpha 0 1 this gamma matrix is of the form 1 minus alpha t minus 1 plus alpha right okay so just try to compute what will be this matrix this is q i minus phi so this will be q 0 0 q minus alpha 0 1 minus alpha 1 this just try it just do it no so this is q minus alpha 0 q minus 1 and minus 1 minus alpha and then you have to find out inverse of this okay so I want to find out q i minus phi inverse how will you find inverse of this yeah so find out cofactor find out determinant 1 upon determinant times cofactor transpose that will give you adjoint transpose or adjoint adjoint transpose adjoint transpose so that will give you the you know and then you know you can you can multiply this by multiply pre-multiply by c and by gamma okay what will transfer function matrix in this case will it be 1 cross 1 2 cross 2 what will it be in dc motor how many outputs are there in dc motor in dc motor there is only one output there is only one input you will get a scalar transfer function q transfer function okay you get a scalar q transfer function what is the relevance why am I so much so I did this calculations for finding out the q transfer function between h 1 h 2 b 1 and v 2 if I have a Laplace transfer function if I have a Laplace transfer function what does it indicate in time domain what does it indicate in time domain let us say let us say well I want to give an analogy because we learn much better much faster with analogy see if I have this Laplace transfer function say y s y us is equal to b 1 s plus b 0 a 2 s square plus a 1 s plus 1 what does this indicate what does this tell you what is the time domain equivalent I multiply both sides I will get a 2 s square plus a 1 s plus 1 into y of s is equal to b 1 s plus 1 into u of s okay now this one is equivalent to a differential equation okay so a 2 s square y will give me d 2 y y d t square so this is what was achieved when you go from time domain to Laplace domain my differential operator becomes an algebraic operator in terms of s okay in some sense well even in time domain people use two notations sometimes they use p instead of s and p is defined as d by dt okay and you can write a p transfer function p transfer function is b 1 p plus b 0 and denominator will be p square a 2 p square and so on okay when you write a p transfer function you will not write y and y s and us we will write y t and u t you are in time domain okay so the advantage that I got when I went from you know time domain to Laplace domain algebraic expression okay I could do manipulation okay in controller design and all that so the same advantage I want to gain in discrete domain that is why I have put this q operator so now this gives me a relationship between inputs and outputs and I am going to convert this analogously to time domain difference equation okay I want to convert the transfer function what happened in the Laplace transform case I had a transfer function between input and output okay I could convert the transfer function into a differential equation they were actually one and the same only they were different representations transfer function Laplace transfer function and the second order differential equation which I wrote okay let us just go back here this transfer function and this differential equation are not different okay is the same thing with two different clothes you know it is just change of drapery it is not that you are looking at two different entities so it is only the convenience of algebra that is why we went to Laplace domain so coming back here I want to be use the same advantage here I want to go back to time domain difference equation okay I have just picked up one of them right now let us assume let us go back here let us go back here h1 is affected by what does this matrix tell you perturbation in level 1 is influenced by both perturbations in voltage 1 and perturbations in voltage through how does it affect through this you know transfer function matrix q transfer function matrix let make a simplifying assumption that perturbation v1 is 0 okay let me make a simplifying assumption only v2 is changing I want to find out how h1 is affected by v2 okay so I am just looking at the sub component of this model h1 affected by v2 v1 is 0 okay now I have just divided here if you look here I converted this from equation in q to equation in q-1 okay just algebra what I do next there is a small error here okay well what is q-1 time shift by 1 what is q-2 time shift by 2 okay so I am going to convert this into a linear difference equation okay this linear differential this linear difference equation here and this q transfer function are equivalent no difference there is different representations the same advantage that I get doing algebra of Laplace transfer function I want to derive here using this q shift operator okay there is no other purpose but this gives me relationship between only the input and output okay yeah basically I want to write current see I have done it in 10 to the power-1 that is because I want to write k is the current instant okay so my convention is going to be k is current k-1 is past k-2 is 2 in past k plus 1 is future okay so when I am writing a difference equation particularly for the behavior at current time instant see I cannot well we will be talking sometime later about future predictions but right now I want to write in terms of what is current in terms of what has happened in the past that is why I have put it like this okay I could have written converted into difference as h k plus 2 and all that but k is my present k plus 1 is future k plus 2 is 2 in future k-1 is 1 in past k-2 is 2 in past and so on so I want to write a difference equation which talks about current equal to something in the past actually this difference equation very nicely tells you about the dynamical systems okay it tells you that current what is happening now okay is effect of what has happened in the past okay see level 1 at time instant k current instant is the linear combination of four terms here on a difference equation it has the memory of two levels in the past h k-1 h1 k-1 h1 k-2 weighted by those two coefficients are just weighting factors okay then it is also influenced by the new inputs what are the new inputs b2k but remember if I if my computer sends out a signal v2k at instant k it will not have an instantaneous effect on y there is always a delay of 1 if I take an action its effect will be seen one sample later okay one sample later our model was x k plus 1 is function of uk okay what you do now will have effect one sample like one sample later so all dynamical systems have memory and this is evident from this equation I get a linear difference equation model here is everyone with me on this is this clear why I went to Q transforms because I could now just talk about relationship between an output and an input okay that is that is the reason now should I do it in this class or should I not okay let us do in the next class frequency domain we are doing controller design we need Nyquist plots I do not think you fondly remember Nyquist plots and Bode plots but you have to use Nyquist plots when you do control my course is mostly going to be in time domain so you will understand a lot of things frequency domain is minimal but there is no way you can escape frequency domain you have in some cases you need frequency domain interpretations which are very nice and there is no other way of going about so we have to touch frequency domain so you have to study this Q transform is only a time domain arrangement I would say a time domain arrangement you talk about shift in signal and then you deal with this using time shift operators difference equation representation here I have to talk about a Z transform okay now Z transform is defined as a Z transform is defined for a signal starting from time 0 to time infinity okay we are dealing with signals which are time 0 to time infinity right see when I start my level control system I will start getting level measurements 1 2 3 4 5 6 and if I do not stop I am going to time infinity right virtually I am going to time infinity so I want to talk about signals which are 0 to infinity is some kind of idealization here in reality you will stop the plant after one day or few days or whatever now here Z is a complex variable I wanted to understand Z transform at a working level not from the complex algebra viewpoint or complex analysis viewpoint take this with a pinch of salt right we are not going to compute those counter integrals in this course but inverse transform once you define transform we have to define inverse transform transform is I will give you analogy for transforms you have some signal say X okay and many times you want to work with some kind of a transform signal so you multiply this by a matrix A which is invertible and you get a new vector Y okay so this is a transform I transform every X to a vector Y by pre-multiplying by invertible matrix A okay and then how do I recover X you know A inverse Y okay transforms are useful they help you you know sometimes simplify the equation okay I will give an example we are looking at this DX by DT is equal to AX we also have BU right now ignore BU just for a second okay actually we have this when we are looking at equations we have B times U let us assume for the time being this is 0 okay now my A is a full matrix okay N cross N matrix my A is N matrix let us assume that this is diagonalizable if it is diagonalizable then I can write ? ? inverse right so I am going to write this equation as DX by DT is equal to ? ? ? inverse X everyone with me on this a little bit of algebra will tell me that ? inverse DX by DT is equal to ? times ? inverse X fine everyone with me on this so this term is nothing but D ? inverse X by DT is equal to ? ? inverse X okay you might wonder why why I am writing like this I am going to define a new variable called Z so this is my Z new vector called Z okay so what is this Z Z is a vector which is obtained by ? inverse X how do you get X back ? Z fine this is my transformation this is my transformation okay now with this new definition what happens is DX by DT which is A times X okay with this Z defined as ? inverse X will give me DZ by DT well this Z here is not Z transform it just a vector which is into ? Z what is ? it is a diagonal matrix there are zeros here there are zeros here what is the advantage of looking at this differential equation through Z over through X here this is nothing but DZI by DT is equal to ? I ZI where ZI is the ith element I get n differential equations which are decoupled which are not related to each other if A is a full matrix which has you know all many non zero elements then solving the original problem is much more difficult than solving this problem and I can solve for Z and I can go back to X using inverse transform right I can go back to X through inverse transform so transforms help transforms really help in solving problems what is Laplace transform what is how it is defined if I have a signal FT integral 0 to e to the power well conceptually this is not different from you know X is a vector when operated by operator ? inverse gives me vector Z okay what is equivalent to matrix here integral it is called integral kernel this integral kernel is equivalent to this multiplying by a matrix okay why do we get integral kernel here we are dealing with functions not finite dimensional vectors we are dealing with a function FT is a function from time 0 to time infinity FT is a function so conceptually these two are similar equations they are not different they are one and the same conceptually okay so yeah no no I want you to understand the philosophy of transforming what I am saying is that why do we transform one is okay algebraically similarity transformation but both are invertible transformations yeah so just draw an analogy one is of course in finite dimensions the other one is infinite dimensions okay so just draw an analogy just to understand what is happening in transforms then see what was what was the point here the point here was when I transform it is easy to work with a transform signal okay it was easy to solve the differential equation and transform domain and then you could go back to the original domain you could do some algebra in transform domain go back to the original domain that was the idea so when I am going to define this transforms the idea is that I should be able to do some things simplified simple algebra which is in the transform domain and then move back to the original domain so this is my Z transform my Z transform is defined as you know fk where fk here is the time domain signal at time instant k and g to the power minus k z here is a complex variable it is related to Laplace variable through this equation z is equal to e to the power ts as I said I am not going to go too deep into this you can probably refer to Astroman Wittenmark or Franklin and Pavel I have given these books in my I will be giving this references as a part of my lecture notes so well just like Laplace transform has some nice properties Z transform also has some nice properties one is linearity if you add two signals and take its Z transform its equivalent to linear combination of individual Z transforms property that is going to be used very often by us is time shift okay Z transform of a time shift signal is nothing but z to the power minus you will find for practical purposes q and z are similar okay as far as to difference equation is concerned they turn out to be quite similar not identical but quite similar so you have Z transform of a signal which is shifted in the past and you have Z transform of a signal which is shifted in future okay so I have given here the expressions the derivations are not so difficult and you can find them in a standard textbook well what do you have in Laplace transform you study initial value theorem same things are here you have final value theorem and initial value theorem and so on what is going to be most important for us is this particular time shift you take Z transform of a time shifted signal you will get this expression you will get z to the power n and you will get z to the power minus n when it is shifted in the past okay just some examples of Z transforms if you take this simple signal you know a step function then I can take alpha out and then take you know summation of one that this is so this in any digital control book you will have Z transform tables and which is similar to what you have in for Laplace transforms for ramp and for sinusoid and then you can go to a book on digital control you will find listing of all these transform the way I am going to use this well I will again revisit this in my next class but I will just preempt what I want to do I want to take a Z transform of my difference equation okay and I want to get a Z transfer function matrix just like S transfer function matrix I want to get a Z transfer function matrix when you have this Q thing why do you want Z because Z is related to e to the power T S where S is complex number and then you can draw frequency response using that interpretation that is not possible with time shift in time shift you are working in time domain okay when you define these operators at some point we are going to use frequency domain interpretation and that is why we need this Z here okay so my Z transform is I am going to take a Z transform of both the sides and this equation will finally yield something which looks very very similar to the Q transform nothing different okay final expressions are going to look not different from Q transform just Q is replaced by Z philosophically they are completely different in one case you are working with time domain in other case you are working with frequency domain expressions turn out to be similar okay so I can find out pulse transfer function for my system by converting my difference equation into pulse transfer function and I will visit this again in my next class in the beginning but I get pulse transfer function all that I have done is same thing except Q is replaced by Z here okay but notice I do not have any more here you know H1 of K and H2 of K that is H1 of Z H2 of Z and V1 of Z V2 of Z and this is my Z domain pulse transfer function this has been obtained using linearization of a first principle model okay so I will stop here and then we will proceed from here in the next class.