Control Bootcamp: Example Frequency Response (Bode Plot) for Spring-Mass-Damper

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back so last time we discussed how the transfer function G is essentially the Laplace transform of our state space system and it's a complex valued function so this G lives in the so the variable axis is G of s and s lives in the complex plane okay and essentially if I plug in I Omega into G of s so G of I Omega tells me what the system does if I give it a pure tone forcing in an IR Omega frequency so sine Omega T in gives me a sine Omega T plus C out this is just a true fact for all linear systems if I plug an input sine wave into my system I get an output sine wave of the same frequency but it might have a different magnitude and phase and so the transfer function if I evaluate G at I Omega so this is like a sine wave in the complex plane the magnitude of G I Omega is the amplitude of my output sine wave and angle of G I Omega is the phase of my output sine wave and so what I want to do is illustrate what this means physically for something like the spring mass damper system okay so I'm going to draw the trusty old spring mass damper okay I've got a spring I've got a damper and attached to that is some mass M okay we're going to say you know this is some spring constant K some damper D and the position of the system X is essentially how far this mass is from rest okay so this is relatively easy to derive the equations of motion I'm just kind of Newton's law for the spring mass system you get something like X double dot let's say MX double dot okay this is my force or my sorry mass times acceleration equals force and so there - K X and a minus BX dot so if I bring them over to the left side I get a plus the X dot plus K X equals whatever external forcing I put on the system so any leftover forces like if I am moving the base or if I have you know something that I hit this with a hammer those all go into my forcing you okay it's a really simple Newton's law here and we know that if I wanted to I could build an Augmented system I could build a state-space system by introducing X and X dot at states of the system so what we're going to do now is essentially look at the Laplace transform of this this system and then we're going to build something called the frequency response or the bode plot okay and so just recall that if I take the Laplace transform of the derivative of D DX sorry D DT of X if I take the Laplace transform of X dot I just get F times the Laplace transform of X minus X naught okay and so what we're going to do usually in transfer function land in Laplace transform world what we're going to do is we're going to assume that all of the initial conditions and transients died out and so we're only going to consider this term here we're going to assume that X naught and X dot naught are all 0 so no initial conditions but you don't have to do that you could use these to solve for the initial condition response so we're going to use this for X 0 equal 0 and then what we also have is we run this through again we get the Laplace transform of the squared DT x equals s squared times the Laplace transform of my variable X and this is really nice because I'm taking differential equations derivatives and I'm turning them into just algebraic terms products of s Squared's and stuff let's say I plugged some real numbers in here I just have a certain mass and a certain damping constant and certain spring so I'm just going to plug in numbers here I'm going to say let's say my system is X double dot let's say plus X dot plus X I'm going to keep it real simple all my constants are 1 and that equals you okay now we know how to solve this oh de in general right I could plug in e to the lambda T and I would get lambda squared plus lambda plus 1 e to the lambda T and I would get my characteristic polynomial if I plug in these terms if I take the Laplace transform of both sides and I plug in these formulas I get something very similar to my characteristic polynomial so what I get is f squared X bar plus F X bar plus X bar equals u bar now remember bar just means I'm in the Laplace transform domain I've Laplace transform that function of time into a function of s my Laplace variable and now I can factor out on both sides my s squared plus s plus 1 times X bar equals u bar ok so this is pretty pretty simple this is my characteristic polynomial so the roots of this function are the eigenvalues of my system they're the e to the lambda T's that that solved the system and so finally I can say X bar over u bar equals 1 over s squared plus s plus 1 and this is my transfer function G of s this is how you get it super simple okay you Laplace transform your OD e and you essentially rearrange and collect like variables so you get your X bars and your u bars on one side and then you can write this transfer function from you in this case I'm measuring X so y equals x and so my transfer function from u to X is this one over my characteristic polynomial and that's generally the case of these simple linear systems okay now we're going to use this to actually figure out this a and this fee function here okay so I could literally take this complex function and I could plug in I Omega for all omegas for all frequencies and I could compute the magnitude and the phase and that would tell me what the output signs look like given an input sign but I like to actually do this with an experiment okay so here I have my trusty who may be black was the wrong color for this room so I have my trusty spring mass damper system okay you can kind of see it and what I'm going to do is I'm going to force the system at different frequencies and in fact I'm going to make what's called a frequency response okay so I'm going to build this frequency response let's do it right here okay I'm going to plot a and C remember a is just magnitude of G I Omega and this is phase of G I Omega and I'm going to plot this as a function of Omega as a function of how fast I'm whipping this thing up and down how fast I'm forcing this u equals sine Omega T okay and a couple of important things you mega is going to be on a log scale so these are really low frequencies over here really high frequencies over here a is also going to be on a log scale so negative means really really small amplitude positive means really really big amplitude okay and so let's let's start doing so this is an example I always do in my class I really hope you can see this phone okay so if I move my hand if I move my forcing Omega really slow so I have a slow sine wave what is the phone amplitude do what is the measurement of this phone's position well it's a sine wave that exact we tracks the input sine-wave okay so the amplitude is 1 and the phase is 0 okay so let's write that down so for really low frequencies I have an amplitude essentially of 1 and I have a phase that's 0 and if I if I make this thing arbitrarily slow it'll have the same behavior the output will track exactly input if I put in an input sine wave the output sine will be exactly the same with a equals 1 and C equals 0 okay this is zero degrees and that's amplitude 1 so now let's say that I take this thing and I go to ultra ultra high frequencies okay this is a little harder to do but I'll try and it might be harder to see so now what I'm going to do is I'm going to whip the my hand up and down really really fast so I'm moving my hand really really really really fast and you can see I mean this thing has an oscillating mode out of plane but it's not moving up and down if I move my hand really really really really fast this thing basically stays put and the faster I move my hand the lower the amplitude goes so this a gets smaller and smaller and smaller the faster Omega is so asymptotically this kind of this this will go down to zero amplitude and it's hard to figure out exactly what the phase is just from watching it but if I plugged in really high frequency Omega into here I would find out that I picked up a minus 180 degrees out of phase so it turns out that I'll be minus 180 degrees out of phase asymptotically now in the middle this is where it's really interesting okay so for example in the middle there's some sweet spot frequency let's see if I can do this where there's some sweet spot where if I move my hand a little I can get this thing really jumping can you see that like yeah the phone is I'm moving my hand just barely but I'm making the phone jump a lot maybe I'll bring my marker here so do it again okay so I'm moving my hand little us is almost impossible two hands but the amplitude is going huge okay when there is some sweet spot frequency the resonant frequency there's some resonant frequency where this amplitude actually goes up so where a is actually bigger than one I put in a little sine Omega T I get a big sine Omega T out and at that point I pass through minus ninety degrees of phase so if you noticed when I do that it's a little hard to make it exaggerated but as my hand is moving up and down and I'm making this thing jump the phone is going in the opposite direction of my hand okay so they're approaching and then a divergent approaching diverging so the phone is minus 90 degrees out of phase with my hand okay so this is called this is a super useful plot this is called the bode plot after a guy named bode or it's also called the frequency response and this very very simple picture essentially tells me everything about what my system does at all frequencies so if I have something complicated like the Hubble Space Telescope or the International Space Station I might want to look at the bode plot to see how does this thing going to oscillate where are its resonant peaks what do I have to actively control to make this thing not shake itself into pieces okay and this is one of the reasons the transfer function is so useful is because if I have a transfer function I can literally plug in I Omega and sweep through Omega and the magnitude and phase of this function can give me all of this information so very very useful the last thing I'm going to show you is actually this is really simple to do in that lab okay so let's do this in MATLAB let's say first things first what I'm going to do is I'm going to define s equals TF of s so this is how you start in MATLAB if you want to do transfer functions you say I'm going to define a Laplace variable and it's a transfer function of the Laplace variable otherwise s could be anything s could be an number or a script or something like that so let me get rid of this okay so the first thing I have to do is define my Laplace variable then I'm going to build my system my G I'm going to say G equals 1 over and I think I had s squared plus s plus 1 ok that's my transfer function that's all it is I hit enter okay I have a continuous time transfer function called G so now this is where it gets really cool in MATLAB I can compute the bode plot really really easily it's one line I say bori of G and what it's going to do is essentially it sweeps through all of Omega this is frequency Omega and radians per second so it's going to sweep through all of these frequencies and it's going to evaluate G I Omega and compute its magnitude and its phase and you can see here's the magnitude in log plot in decibels and just like what we predicted for very low frequencies the output has 0 DB so the log of 1 is 0 so the amplitude is 1 meaning that the sine wave is exactly the same as the input sine wave and the phase is 0 as I increase the forcing frequency and you can probably see this now against our behind the white background as I increase the forcing frequency I hit this resonant peak here where the telephone is jumping and then for really really really high frequencies my amplitude decays so if I move my hand a lot the phone doesn't move hardly at all okay and so this is really easy one line in MATLAB just bowi of G and you sweep through this whole frequency response curve for this system now if I had a system that had a lot more damping so if this term it's my X dot term is a lot higher then maybe this thing wouldn't oscillate so much maybe it would die out quickly and not have a resonant peak or if I made this damping much much smaller maybe I could make my resident peak much much bigger okay so if I make my damping smaller ten times smaller now I've got this let me move it over here now I've got this monster resident peak here because I have such small damping if I force this thing a little it's really going to whip wildly around okay so I got this big resonant peak all I did was decrease damping okay so this also fits our intuition it makes sense and if I increase the damping a lot so let's say I make this ten times bigger than my original damping I should completely get rid of my my resonant peak and in fact something weird happen because I made it I made it too big and I could probably go for that's that's probably a good one okay other cool things you can do once you have a transfer function in MATLAB I can compute the impulse response I can compute the step response so let's do that so let's redefine my G to be the original G and let's just type in impulse of G so now what you see is if I this is if I had my system and I whacked it with a hammer the position will increase then overshoot and oscillate and eventually go back to rest but it's going to do it by oscillating back to rest and that's what this impulse response tells me okay so that's literally if I took this system and I whack it with a hammer okay now if I do a step response let's do that if I have a step response see now it goes from zero to one and it oscillates while it does it so that's if I take this system and instead of just whacking it once I give it like a constant offset function so I force it forever at some value but I step my control from zero to one that's kind of like if I jump this thing down so notice I just drop my control it oscillates and it ends up at a different study state value so now its position is one where it used to be zero okay so lots you can do with Laplace transform try for functions they tell you how the input sine waves turn into output sine waves they give you the amplitude and the phase just by evaluating G at i/o Mecca really easy to code up in that lab easy to compute from an OD e and then what we're going to find is that looking at properties of let me bring up the bode plot by looking at properties of this frequency response plot we'll be able to tell is our system robust is it not robust where is it sensitive what kind of disturbances can it reject what kind of noise is it sensitive to we're going to be able to get all of that intuitively from these these frequency response plots and it's all coming up thank you
Info
Channel: Steve Brunton
Views: 19,916
Rating: undefined out of 5
Keywords: Control, Control theory, Linear algebra, Eigenvalues, Closed-loop, Feedback, Controllability, Robust control, Sensitivity, Complementary sensitivity, Loop shaping, Robust design, Optimal control, Matlab, Applied math, LQR, LQG, Simulink, Kalman filter, transfer function
Id: e-8y4MTT7NQ
Channel Id: undefined
Length: 18min 30sec (1110 seconds)
Published: Tue Mar 07 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.