Lecture9: System Identification I

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hi this is lecture number nine and in this lecture we're talking about system identification this is part one of two part so here we are in this unit and these are some of the topics we've talked about and so now we're talking about the subject of system identification so when it comes to system modelling there are two methods we've been talking about the first method is the analytical method the analytical method uses for example the laws of physics KVL KCl Ohm's law all those different device characteristics that we have equations for and we actually write out the equations and based on the equations differential equations and algebraic equations we end up with a model of a system the other method that we would use is called the empirical method the empirical method is a method that involves experimentation so we have the two different methods we've talked somewhat about the analytical method so in that we've we've looked at modeling of electrical mechanical systems we've talked about the h transform and how it it takes a discrete continuous time system and gives us a discrete time model so Indian method that we're going to look at now the empirical method in this method it automatically it automatically gives you a sample data model of a system so you don't actually have to use the h transform it's kind of embedded in the entire process so two different methods so an important question is how do we obtain a transfer function empirically so in order to do this we need to use a little detective work we need to use the data that's available to us and and basically obtain a model from that so here is the approach we're going to take that approach that we're going to take involves a an arrangement like this so this is the arrangement we use to perform the experiments that we're going to be doing that that give us the model so basically we start with an excitation signal that we apply to our system through D to a converter okay so there's a so that's important the output of the system then is sampled by our 8 D converter we take both the the input signal and the output signal in discrete time into something I called an identifier algorithm and from that identifier algorithm we get a model so this is the approach that is used in that we're going to use and in terms of the experiment layout so we we basically use the connection of the system exactly the way we're going to use it so in this case we apply a some kind of a signal to the input of our system we compare the input and the output of our system and get a model so that's the basic idea for this so in this process we have four steps that we're going to we're going to go through first step is called experiment planning here we plan the experiment out we there are a lot of there are quite a number of details associated with planning the experiment the second thing we're going to do is do the selection of model structure these two steps together form what I call the paradigm for our system identification process so once we've done that then if we're going to do a parametric model then we will do the parameter estimation the estimation of the parameter so for example if we're looking for a transfer function then we'll be looking for the coefficients of the numerator over the denominator okay so those coefficients are parameters of our model and so for seeking those then we would estimate the parameters from the data that was obtained now obviously the way we obtain the data is going to have a big impact on how we do our parameter estimation finally we have model validation model validation basically is a sanity check to see if what we've done it makes any sense at all and it or rather if the results that we get are meaningful useful okay so it's a way of going back and checking to see if this whole thing was done in a way that actually makes sense and and or and or whether or not the model is even usable so bye-bye model validation we will go back and check to see if it's even useful and so we're gonna have this each of these steps requires sub steps associated with them and so we're gonna march through all of these steps experiment planning first of all how much data are we going to use what sampling rate are we going to work with okay so when we do this to do the experiment we have to pick a sampling rate to begin with how do we know what sampling lead to pick well that's not always obvious generally you want to the sampling rate to be related to the control ultimate control problem that you want to use so that is you want it you want the sample rate to be small enough to to capture all the important transient characteristics that we're looking for but not too not too small okay we don't want it to be too small so small enough not too small so there's definitely a range of useful values of sample rate and so it's it's it's common just to start and just to pick one just to pick something that makes sense for our system so if your system moves really really slowly then a sampling rate of one second might be fine if your system you know for example like in in aircraft like autopilot then that kind of thing those kind of controls use a 20 millisecond sampling rate okay so that's a very common sampling rate for an aircraft 20 milliseconds which is obviously a lot smaller than then one second sampling rate sample period so then there's the type of excitation signal that we're going to use what kind of a signal do we apply is a step input okay a delta function sinusoid what kind of a signal is really gonna be useful for us okay and so we'll talk about a lot of these these characteristics these these details of the experiment availability and use of op tree data so what does that mean well for example a motor you're turning a motor if you apply a voltage to the motor and the motor will turn obviously if you let if you turn off the voltage the motor does not return to its original state after you turn the motor off in other words it doesn't so when you apply voltage to the motor turns right and then when you take away the voltage it doesn't turn back okay and and that you know it sounds like why would it turn back well obviously a motor mode won't won't turn back so that's that's important that characteristic of a bingham applying a voltage having them having the the motor turn and then not going back after you release the voltage that is eight that corresponds to a particular characteristic of a system that is the system has a free integrator in the system that is the denominator the system can be factored in the Laplace domain can be factored and have an S term by itself in the denominator okay so the that fact is an important fact in working with the motor okay that's a priori data we know that ahead of time and so we can actually incorporate that data into our model when we when we work with the model to obtain the model parameters what about available resources available resources for example what computer is available to us what kind of calculations are we going to do in other words are we going to try to do this their system identification using MATLAB on a PC are we gonna try to do this on an Arduino you know what what exactly are we looking for what are the resources we have available to us also online or offline computation do we are we gonna try to obtain a model while the system is on the operation that's the online or offline that is we collect a bunch of data and then shut the system down and process that data and get a model from that so those are two different methods and of course that will definitely affect the type of experiments to work with finally pre stabilization is our system initially unstable if so trying to do system identification with the diagram that I just showed will not work because the system will blow up and that's not a good thing okay so we may need a controller to pre stabilize the system and so we actually identify not the originals the actual system but a stabilized version of that system and then how does that stabilization include how does that affect the the results that you get when your so these are important issues that we need to address in the experiment planning okay the hypothesis is the selection of model structure so when you think of an experiment whenever you're doing experiment you you it's important to have a hypothesis in other words what is it we're setting out to prove one way or the other okay so a lot of what you're learning in this lecture is about empiricism that is how do we actually proceed and approach the problem of trying to trying to obtain a model well in a sense you already need some idea of what you're looking for and based on what you're looking for then you can perform an experiment to help you see if you know to see that characteristic that behavior so that's that's what we're looking for when we look at a when we look at the selection of the model structures first of all we want to incorporate prior knowledge what knowledge do we have prior so I talked about the integrator for example does the system have an integrator if so then we want to incorporate that into our model so we can assume for example no prior knowledge some we're starting from scratch assuming nothing about the system in which case our system is considered a black box okay it's considered a black box black meaning no knowledge about that the light there so or suppose you have some prior knowledge in which case the system is a grey box it's not completely black it's grey you've got a little bit of light in there and so those are those are two different things to think about in terms of the model structure so if if we already know something about the model structure then we want to incorporate that that's our gray box but if we if we just assume nothing about our system or very little better system then then we would start with the black box what kind of model are we looking for a parametric model for example a transfer function is that what we're looking for or are we looking for a non parametric model for example a bode plot okay or a Nyquist plot so these are two different types of models that we may be looking for and actually when we do the system identification process we're primarily looking for a parametric model however we will also use a nonparametric model to evaluate the parametric model so that when we talk about the model validation that's one of the things we'll be using to validate the system will actually do both well types and compare them and see how they compare if they don't compare well that's probably there's something that there's something behind that we need to check into that in terms of the model structure or you know we're thinking for example of a transfer function so are we looking at a particular order of our transfer function you know are we looking at a second order model third order model what kind of what order of transfer function that's important in the hypothenuse selection of the model structure also the relative degree are we expecting a particular religious decree so remember the relative degree is is the order of the numerator divided by the order denominator are we expecting a particular relative degree and if so then we may need to incorporate that into our model structure so that's our model structure we're generally going to be assuming train function that we're looking for we're gonna fix the order to be some number second order third order whatever and then then we'll proceed from there so having fixed now our model structure we we perform an experiment we get some data now what do we do with that data well we have a model structure that we're looking at and if we're looking for a parametric model for example a transfer function then we're looking for the coefficients of the numerator and denominator so now we have a model we have data how do we get the parameters of that model to fit the data okay and so that's this subject of parameter estimation that is we're seeking to find the best values for a given parameterization so if we have a third order transfer function for example that's our parameterization what are the coefficients what are the best coefficients for a given parameterization so in order to determine what best means we have to have a way of evaluating good versus not good in the model and so we would select an appropriate cost function we want to minimize for example least squares the squares would be the cost least squares means we're trying to minimize that cost okay so in general we we we talk about this in terms of cost because we have the general thought that high cost is not good while low cost is good okay and so we generally will take this and cast it as a standard optimization problem for example a least squares problem and then solve that so that's this is the approach that we will take towards parameter estimation and again we're just marching right through the four steps of the system identification process in general in in a little detail very little detail but kind of addressing the main important issues here we're gonna go back later and then we're gonna actually look and see how to actually do these things model validation again is the sanity check of the system identification process is what we came up with even worthwhile second does the obtained model actually fit the data okay so we we for example will go through the parameter optimization and we'll get a set of parameters those that's that basically is a numerical transfer function that we will get as transfer function actually fit the data maybe does maybe it doesn't we're gonna find some things that can cause it to not fit the data so some tests then will need to be run to validate the model okay so it's very common to have data that's generated from an experiment that's used to do the parameter estimation then use a different set of data to actually do the validation to see if it works on different data and not just the original data okay so that's important so ideally such test should be independent of the data used to obtain the fit so that's what I was just talking about tests should also the test that we run for model validation should be in the domain of fit as well as alternate domains so what are we talking about here okay so we're gonna obtain the data for for from our experiment in the time domain okay that's how we're gonna mostly actually we're gonna look at a couple different methods we're gonna actually look at time domain we're also gonna look at the frequency domain okay so so but in the time domain then we if we take our data in the time domain then we can compare the transfer functions in the in the alternate domain which would be the frequency domain okay so those are that's we're talking about when they talk about alternate domains time domain versus frequency domain okay so let's look at a couple of introductory examples so here's our first introductory example again we have our configuration setup and I apply a sequence of values to our input okay so basically you can see this is just an alternating sequence one minus one one minus one sequence and we apply this data to our are to a system and out comes this data so we get these values coming out of our system when we apply these these values so K is the time variable in this case we're only choosing five values so it's not a lot of data but this this is just to kind of help you see some of the process that we're gonna go through so here's the data that we get and we're gonna start with this hypothesis I'm gonna a first order system okay that is strictly proper strictly proper in this case means the denominator evaluated at at Q equals zero is 1 and the numerator evaluated at Q equals 0 is 0 okay that's a strictly proper system so and so this is a first-order strictly proper transfer function we're looking to find the values of a 1 and B 1 those are the parameters for this model okay in this case we have two parameters we have five pieces of data two parameters okay and so we're gonna try to find the a1 and b1 that best fit the data and when we say best fit we mean in terms of least squares so this transfer function if we have output Y and input U corresponds to this difference equation okay so when we look back at difference equations there was a direct relationship between a transfer function and a difference equation so this is the difference equation that we get from this transfer function okay and so what we're going to do then is we're going to use the available data this is this is our hypothesis now in the time domain okay so this is our hypothesis and that's why we need to go to this because our data is in the time domain and so now I want to use the data with this hypothesis to to evaluate the and just try to solve for the unknown coefficients a1 and b1 okay so I'm gonna stack the data from 1 to 4 y1 y2 y3 and y4 if this actually if if the coefficients a1 and b1 exactly define the model then we actually get equality here okay so y1 would be equal to minus a1 y 0 plus b1 u 0 Y 2 is equal to minus so that's just again this difference equation where I let k equal one two three and four ok and again I just stacked the equations together so notice a 1 always appears in this column B 1 always appears in this column we can factor that out this way a 1 so I have this matrix times this column gives this vector okay so this a one multiplies the elements in this column B one multiplies the elements in this column and so we get the this situation going now in this case we know the Y values and we know that U values and so we have a linear equation okay we have a linear equation we can write it this way y is equal to x times theta theta is our set of parameters and I use theta here only because it's very common in the in the literature for system identification not because I want to confuse you using Greek letters it's all Greek to me but so anyway we have this linear equation y is given by this so again Y here is associated with the the values here y 1 2 y 4 we just plug those values right in and we get this vector X here is this matrix and so again we plug the values of y and u in and we get X okay so here's y values here you go actually these are minus y values these are u values notice that these are are shifted and negated so that's again from this from this difference equation we got that and so our theta is our set of unknown so this is known this is known this is unknown okay and so we're gonna solve for that and to solve for that now we have more equations than we have unknowns that is we have an overdetermined problem the least square solution to this overdetermined problem is the pseudo inverse of x times y in this case the pseudo inverse of X is equal to X transpose X inverse X transpose and in general this is the form that we're going to be using when we do the least squares method because our we will generally always want more data more equations than we have unknowns and again that's that's because we're trying to fit the data and our data itself may be noisy so there's no single value that we know is absolutely right and so we have to you have to work with that that fact so so this is the way we're gonna do it so this is pretty much always going to be the pseudo-inverse form that we're gonna be using in this case because of the fact that our X matrix is always gonna be tall and thin okay and what that is we have lot more equations and we have unknown so the equations is the number of rows the unknowns corresponds the number of columns and we will pretty much always have that so in this case X transpose X is gonna be given by this X transpose y is given by this from those matrices that we had before and so when I multiply it when I take the inverse of this times this I get this and so now this is this is a 1 this is B 1 so B 1 with the numerator a 1 went in the denominator and so we have this this is our model now so we have taken an experiment experimental data we have applied it using the different the hypothesis and now we obtained a parameter we we optimize the parameters of our model and so this is the model that we obtain from our from our from the process that we've done so far so we we now have a tool for obtaining a transfer function from data alright so this example illustrates two parts of this process it it illustrates the selection of a model structure and illustrates the parameter estimation so those are important things and that those are the parts that actually make us feel good about about this that we can take data and actually get a parameter parameterization for that ok so we we haven't really this didn't illustrate much about experiment planning or model validation the process of that okay here's the second example here's some other data we apply this sequence of values so where did that sequence even come from we apply the sequence of values and we get this sequence of outputs okay notice that in general we will not get nice integer values to work with generally it you know we get messy stuff okay so here is our hypothesis that we're going to use for this problem it's a second order transfer function it has unknown coefficients a1 and a2 b1 and b2 second-order so we're gonna try to find the values is the best values of a1 and a2 sets that the data fits this model okay so that's what we're looking for so associated with this model is this difference equation so notice that here I'm assuming a negative sign okay it turns out that that's very common when you look at for example when you look at the Laplace transform of various signals it's very common to have a negative sign here so we're gonna assume that it's at negative sign here in our in our model and and so if in fact this the sign is negative then this coefficient will be positive so that that's all all this is doing it turns out that when you go through the system identification process if you assume that this is positive you'll like and it's supposed to be negative it'll come out to be negative so it doesn't really matter if you put the signs in but this is just to kind of illustrate what we're looking for so we're looking at the values a 1 a 2 B 1 B 2 and this transfer function is related to this difference equation there's a one to one relationship and actually we could assume this difference equation as our hypothesis instead of the transfer function there's our hypothesis we could have assumed the difference equation as our hypothesis they're equivalent and so we could choose one or the other so notice that this negative sign corresponds to this thing positive this positive sign corresponds to this being negative in the way the differential difference equation is formed so that's our hypothesis and now we can take the data and use this hypothesis to stack this data okay so we're gonna stack it from K equals 2 to 9 and this is what we get this is similar to what we did before okay so this row times this column basically gives that difference equation at K equals 2 now why don't we start at K equals 2 instead of K equals 1 or K equals 0 well the reason is that in this difference equation I only I assume that I only have knowledge of data of why and you from time zero on okay and so this when K is equal to two we get K equals zero here I mean we this becomes 0 this becomes 1 this becomes 2 if I were to choose k equals 1 for example that would require knowing y at time minus 1 so I can't assume that so I'm gonna assume for this that K goes from 2 on so in our case we have from 2 up to 9 available to us and so I stacked that data so notice that here I get positive signs here I get negative signs because of our hypothesis okay and so this is we've stacked the data into a matrix equation like we did before and now we want to solve this matrix equation so again we can write this as y is equal to x times theta x transpose x comes out to be this X transpose Y comes out to be that the pseudo-inverse then when we solve it gives us this this then gives us the transfer function so these are the parameters that we solve for this is our best parameters theta star theta star and so this gives us this transfer function so we've gone through a couple of examples now let's look at the general solution to this problem in the general solution we have n data points okay so we go from 0 to n minus 1 that's a capital n data points so we applied the sequence of values you from x 0 to n minus 1 we simply obtain these values Y from 0 to n minus 1 so we have data ok we have 2 here next we assume a parametric model we're gonna assume a transfer function of this form okay so in this this transfer function we have a monic polynomial in the denominator in this case that means when we evaluate the polynomial at 0 we get 1 when we evaluate the numerator at 0 we get 0 so we're gonna assume that as part of our hypothesis we're gonna assume that our plant is strictly proper and we're gonna look for coefficients we want to be m and coefficients a 1 to a n so that I have n coefficients in the denominator am coefficients in the numerator these two may not might not be the same and so we kind of keep it general that way so this is the model we're gonna look at this model this transfer function is related to this difference equation either this form or this form okay and so we're going to this again we could have started with this as our hypothesis but we know there's a direct relationship between the transfer function and the difference equation now I'm gonna take this equation and I'm gonna factor out the unknowns this side of the equation when I do that this is what I get I get this row times this column so these this column has all the unknowns in it and then this is gonna be a value that's known and then I have a vector here that's a row vector that's unknown so I'm gonna take my data and I'm gonna stack it remember I have n data points okay notice that I'm gonna want to start it at whenever this is equal to zero so this is the smallest the earliest value of y earliest value of U so whichever is whichever is larger of N and M I'm gonna start with K to be that in general we'll have we'll have and be the larger but it could be the other way around so for now we're gonna assume that n is and that n is larger but again does it doesn't matter we could easily switch around the other way okay so we're gonna define for L now we're gonna stack L rows I'm sorry L minus n rows in into this matrix okay so L minus n rows and so this is what we get when we stack the data in two rows so this is the rows in X this this is the values in Y and again we still have our parameter vector that's unknown we're going to try to solve for so again we get this equation and if we use all of our data that is when L is equal to n then we have Y and X n times P so we have our known data we have our unknown data we can solve the linear algebra problem and again we the least square solution the optimal set of parameters is given by the pseudo-inverse of x times y so here's the pseudo-inverse of X X transpose X inverse X transpose Y and so we have the optimization of parameters for this problem so having solved the linear algebra problem we're able to come here so we've talked now about the two parts the model selection and the parameter estimation now let's back up and talk about experiment planning so experiment planning is part of the system identification process it's the first step in the system identification process so in experiment planning first thing we need to look at or first thing we're going to look at is the excitation signal the excitation signal needs to be sufficiently rich that means it needs to be exciting it needs to be whoo-whoo exciting to the system so in particular it needs to be at least on the order of the model to be fit that's like the minimum requirement but in general we want a high order excitation signal the signal that's needed is needed to excite the system in all its nooks and crannies that so if our system has for example a resonant peak then we want to be able to have a signal that has a strong component at that frequency and and so forth or not if we add a notch we want to be able to identify that notch so in particular the signal should not cause the system to either blow up that's not good or enter into a non linear regime okay we'll talk more about this nonlinear regime when we come back to the the problem of robust system identification in the next lecture so we'll come back to this guy also the signal should not should contain enough data values to provide a good fit in general the more data the better okay so what is this deal about the order of the signal what is the order of the signal so the the order of the signal is the greater of the order of numerator a denominator of the signal so example these two signals in the Q domain are first-order signals this is a step input this is a signal that alternates plus and minus one and these are first-order signals here is a second-order signals this is actually the Q transform for a sinusoid so even though the sinusoid all you know it's continually moving it's moving in a such a rhythmic fashion it only counts as a second-order signal for higher order signals we can consider something like a chirp signal sometimes called an FM frequency modulation this is a sinusoid where the frequency of the sinusoid keeps changing in this case it keeps increasing this will if you were to take the the Q transform of a sampled version of the signal you would generally get a high order transfer from national function out of it if we look at the frequency response of this signal we basically get a signal that's flat out to a certain frequency okay and that drops off after that but it's fairly flat so the idea flat is good that means you're considering they're all frequencies roughly the same so at least in that region that all the frequencies are roughly the same that's that's pretty good another signal that has a flat frequency characteristic is the sync signal it's flat out to a certain frequency and then it drops off after that so if you remember a true sync function that goes from minus infinity to infinity actually has us is actually as a frequency domain that's a square a box right and so here this it's almost a box and that's because we don't go out all the way out to minus infinity getting go to infinity here we're gonna stop at some point and so because of that stoppage we get this happening so but what's important is that it's flat out to a certain frequency now it turns out that the sinc function is such that if you take the sinc function and compress it in time that basically expands the frequency response out so I could actually expand this frequency response all the way out to the Nyquist frequency by compressing this sinc function down but but the problem is when we sample that sinc function that's compressed down if we took if we compress it all the way down will basically get something like a delta function will have one at this value and then zeros everywhere else and that's a very simple function to implement you just have all zeros and then a one and then all zeros very simple to implement however when it comes to identifying systems with a lot of noise or and so for example your system the sensor that you're actually using to measure the output could have noise associated with it that noise is going to be it's going to create problems if you have if you're applying an excitation signal that's all zeros and a one okay so it turns out that's that's a problem so in theory this would make a really good system identification excitation signal but in practice not so much another rich signal is a multi sign so multi sign is basically a signal that's a sum of sinusoids of various frequencies okay and the frequencies are basically give us these little p key values in our frequency domain so it's P key at various Sciences that you emphasis specific sine frequencies that you add together so the value of the multi sign is that it it gives you Peaks which allow you to accurately represent or identify the system at those peak values so if there's a if there's a particular feature we're looking for for example a resonance or a knotch then we would want to apply a sinusoid at that frequency just to get to be able to identify that well another very important rich excitation signal is a random binary sequence and if you were to plot around a random binary sequence this is what it looks like it's either plus 1 or minus 1 and it switches and so since this function is actually either plus 1 or minus 1 you don't actually see any transitions between the two and so you just get what would look like a line in the line and so the frequency response of that looks something like this notice that it's noisy it's very noisy which means you have very high values of the frequency response and also very low values of the frequency response so but it turns out because what we're identifying is a rational function the rational function can't change that quickly in terms of its its smoothness and so turns out this is actually a really good signal it's very fairly easy to generate we'll come back in later and see how to generate around a very binary sequence but this is an important signal for us and as you can see the frequency content goes all the way out to the Nyquist English frequency now what about excitation for marginally stable systems one of the system things we said is if our system is unseasonally stable okay so for systems that are marginally stable that is we don't want our system to blow up while we're applying that doing the system identification process so for systems that are marginally stable care must be taken so again marginally stable has in Laplace transform poles on the imaginary axis and the reason is is that if you have poles on the imaginary axis a bounded input can give an unbounded output that is the output can blow up and that may not be a good thing okay it for some signals for some systems that's not necessarily a bad thing but it can still come back and bite you so you just have to be careful so a rich signal can generally be found that doesn't cause the system to blow up so here's an example of a signal I call it a modified chirp so notice it has a chirp component in there but then it also has like this pulse and pulse up and pulse down that's attached to it and then I take this whole thing and I turn it upside down and I apply it again okay so this half is the negative of this half and so what happens then is when you apply this part of the signal your system may meander off and then when you apply this version it meanders back so it doesn't go too far away whatever however far it goes in this part it will go it'll come back in this part so another example are of a random sequence so a random binary sequence can be obtained by taking a random sequence like a band limited white noise putting it through a sine function function so again the sine function if it if this signal is positive it will give it one if the signal is negative it will give a minus one and so that's that is how to generate a random binary sequence but now we're gonna take this signal and subtract this signal from it this is a transport delay is a time delay so we're gonna take the same signal so whatever signal this is we're gonna apply it to the system then we're gonna take that same signal and we're gonna subtract it sometime later so basically what happens is this signal is constantly having a random sequence applied and we're also having its negative applied so the result is that this is that the system with a pole at the origin will not drift off too far it will still drift but it will drift off very far okay so this is important so this is the these are some rich excitation signals and we'll we'll use these we'll use the actual we'll actually use this one quite a bit because one of the systems we're going to be doing a lot of system identification experiments with is a motor which has a pole at the origin so this is this is why we would use this particular one so how much data so this is part of our experiment planning how much data in general the more the better obviously limited by computer power or memory but I have to say that things have changed a lot since since I first started teaching this class when I was teaching this class the first time I taught this we were teaching I was teaching this on a the students were using an IBM PC this is even before the Pentium days 386 computer 286 computer do you guys even know what that is and I think maybe we had a few Meg's of RAM Meg's yeah Meg's so this thing's have come a lot a long way and so what was once a lot of data for example two to the fourteen data point sixteen thousand data points what was what seemed like a lot of data now is like doesn't it's not that big of a deal and the computation power required to do it you know you know we would use two to the fourteen and that's a that's a great number that's a significantly large number and it used to be we'd have to wait for the result now there's really pretty much no waiting so how much data well data is not as big of an issue as it was in days past so next we come to the subject of model validation in model validation which is the fourth part of our system identification process we have the question again it's the sanity check so how do we validate our system well practically speaking as I mentioned we're gonna want to use alternate donate domain so our data is collected in the time domain and so the frequency domain is an alternate way of looking at the data so because they're alternate domains they it's basically taking the same data and looking at it in a different way and if by comparison from by comparison if the if things compare well in the frequency domain that's a pretty good way of evaluating whether it's a good fit so the FFT basically takes a sample signal gives an approximate Fourier version of that signal so we've seen that already this can be used to obtain the ultimate perspective on the system so what we're looking for in this frequency domain approach is a nonparametric model of the system that can be compared with the outcome of the system identification process okay and so this is what we're working with okay so we have a signal that we sample we're gonna take the signal we're gonna sample it put it through our FFT we're gonna get a signal out okay and so in general we'll go our frequencies we'll go all the way out to PI over to the night PI over T the Nyquist frequency okay and so so that's what we're gonna be looking at here so here I plotted you e to the G minus G Omega T remember that the Laplace transform of this signal if we were to plot it we would actually have to put a T out front the sampling time out front and of course multiplying by the sampling time is in general gonna gonna change the magnitudes so that's a big issue when you take a set of n values for example n is equal to to the power L n values and you take the FFT so here this is in time domain this is now in frequency domain these are the these are the actual frequency values you get we get e to the J zero all the way up to GE to the J 2 pi n minus 1 divided by n so this if n is large this is almost 1 so it's like frequency J 0 to J 2 pi okay so basically these e to the J values basically are equally spaced values around the unit circle okay equally spaced around the unit circle now it turns out that what happens on the top half of the unit circle the bottom half of the unit circle is the conjugate of the top half and so it in terms of magnitude there's there's basic it's like a mirror image of what happens and so we only need to use half of this data so basically we take this data we convert it into the frequency domain we only use half of this data in evaluating the frequency response so here's what we do in order to obtain a nonparametric model using the FFT we first perform the FFT on both input and output we obtain the input/output ratio of that data this gives us an estimate of the frequency response of the system this estimate can be used to obtain a bode plot that is a nonparametric model so in terms of a block diagram we take our system we apply art our input we sample our output we put both of these into an FFT both of these signals divide this signal by this signal and that gives us an estimate of our transfer function okay that gives us an estimate of our transfer function so here's an example of the kind of thing that we could get okay so here's the sick here's a system that we have and we have multiple so multiple orders we have the actual system we have a second order model third order model for third model and then we have the data so the data here is is what we get from our from our FFT okay we we take that FFT of Y FFT of you divide the two and we get the this and we can plot that as an F our D and so that's that's what this this orangish color is yellowish color so so we have these these responses so our actual system notice goes down here like this the second order model notice that this system has a resonance here the second order model has a resonance but first of all this initial data out here is not very close this data out here high frequencies is not very close so the data for the second order model this shows us the second order model is not a good approximation of our system so if we if we just did a second order system identification with this we would not have a good model okay so this um this green which is our third are actually there's an orange and green here and notice that the both the orange and the green live pretty well on top of the actual transfer function and so out here at low frequencies we see that in fact we get you know there's a divergence that happens but keep in mind that what's happening down here this is these values are very small ten to the minus five compared to for example these values over here so you know they're ten thousand times smaller than what's going on even right here and so this is so this is insignificant and so really what we can see now is that the third order model so in other words we used actually three different hypotheses the second order model third order model fourth order model the third order model we can see actually fits the data well and so using the principle of parsimony that is the principle of keeping things as simple as possible in this case would mean we would choose the third order model as our model okay we would not go to the fourth order model and and so we'll actually see why when we do this but this then is the example that we have so this is an example for some data and in this case we actually use quite a lot of data like two to the 14 data points I know I'm not bothering to show you all those data points because it's just like a lot of numbers you don't need to see all those numbers okay but what we can see is that that by trying the different hypotheses we can actually and again the count the calculations once you have your problem set up the calculations are very straightforward to do and so we can we can we can easily do the second order model third order model fourth order model for these for these systems but for this data okay and as we can see it works pretty well does not work well for a second order which means the second order model is not good but it does work well for the third order fourth order model and it actually the second and third I mean the third and the fourth actually fit the actual data the actual transfer function well and notice that the data actually fits the transfer function fairly well out till about this point and then after this we least we say the that it gets lost in the noise okay so you can see the signal is very noisy and what happens is that the signal gets lost in the noise so we have things like what's called a signal signal to noise ratio signal to that is there's a certain amount of noise there and if the signal to noise ratio is too low we were not able to see things very well and in also what that means is that we kind of need to not pay too much attention to the fit out here so the second order system the fit out here is not very good so we definitely can reject that but the fits the data fits that we get out here are pretty good so this is helpful and so what we've seen is in the ideal case the least squares technique works great least square system identification works great however the technique begins to break down under some real situations nonlinearities quantization noise and we'll we'll we'll see how that happens and so the question is how do we recover a good fit in using this approach how do we how are we able to still do system identification and obtain meaningful results even if we have some of these things going on so that's the practical system identification and we'll come back and look at that next time so this is an overview of the whole subject of system identification it's a big subject thanks for watching [Music] [Music]
Info
Channel: Computer Control Systems
Views: 7,386
Rating: 4.9142857 out of 5
Keywords: Computer Control Systems, Digital Control, Embedded Systems
Id: cZS5of6cTOU
Channel Id: undefined
Length: 52min 50sec (3170 seconds)
Published: Fri Mar 03 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.