title
Control Bootcamp: Kalman Filter Example in Matlab

description
This lecture explores the Kalman Filter in Matlab on an inverted pendulum on a cart. Chapters available at: http://databookuw.com/databook.pdf These lectures follow Chapter 8 from: "Data-Driven Science and Engineering: Machine Learning, Dynamical Systems, and Control" by Brunton and Kutz Amazon: https://www.amazon.com/Data-Driven-Science-Engineering-Learning-Dynamical/dp/1108422098 Book Website: http://databookuw.com Brunton Website: eigensteve.com

detail
{'title': 'Control Bootcamp: Kalman Filter Example in Matlab', 'heatmap': [{'end': 1313.802, 'start': 1292.771, 'weight': 1}], 'summary': 'Covers the development and application of kalman filter in estimating the state of inverted pendulum and control systems, building an augmented system with disturbances and noise, tuning knobs using vd and vn matrices, discussing the use of kalman filter for system estimation, and simulating system response with augmented input and noise in matlab.', 'chapters': [{'end': 187.897, 'segs': [{'end': 43.827, 'src': 'embed', 'start': 3.51, 'weight': 1, 'content': [{'end': 3.95, 'text': 'Welcome back.', 'start': 3.51, 'duration': 0.44}, {'end': 12.94, 'text': 'So in the last video we looked at when this inverted pendulum on a cart is observable.', 'start': 5.392, 'duration': 7.548}, {'end': 22.689, 'text': 'So we looked at what c matrices made this pair observable for this full state and also for just the state x dot theta and theta dot.', 'start': 13.54, 'duration': 9.149}, {'end': 31.717, 'text': "And so now we're actually going to develop a Kalman filter to estimate this full state, so all four variables from a single measurement y.", 'start': 23.55, 'duration': 8.167}, {'end': 43.827, 'text': "And if you recall, we're going to use the measurement c equals which corresponds to just measuring the cart's x position, the first variable here.", 'start': 31.717, 'duration': 12.11}], 'summary': 'Developing a kalman filter to estimate full state from a single measurement in control system.', 'duration': 40.317, 'max_score': 3.51, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX83510.jpg'}, {'end': 105.965, 'src': 'embed', 'start': 63.067, 'weight': 2, 'content': [{'end': 70.13, 'text': "So what happens if I start my pendulum in the up position and I have my cart and I let it go and all I'm doing is estimating.", 'start': 63.067, 'duration': 7.063}, {'end': 72.691, 'text': "So I'm not actually doing feedback control, I'm just estimating.", 'start': 70.17, 'duration': 2.521}, {'end': 80.514, 'text': 'Well, very rapidly the pendulum falls down and it leaves the region where the linearization was valid.', 'start': 73.351, 'duration': 7.163}, {'end': 85.557, 'text': "So the linearized model is only valid near the equilibrium where the pendulum's up.", 'start': 80.714, 'duration': 4.843}, {'end': 88.258, 'text': "And because it's unstable,", 'start': 86.157, 'duration': 2.101}, {'end': 97.262, 'text': 'the only way I can really have a good Kalman filter demonstration for the pendulum in the up position is to already be stabilizing it using full state feedback.', 'start': 88.258, 'duration': 9.004}, {'end': 105.965, 'text': "So I'm going to wait to look at the pendulum in the up position until we're ready to combine the Kalman filter and the LQR regulator.", 'start': 98.422, 'duration': 7.543}], 'summary': 'Linearized model valid near equilibrium; need full state feedback for good kalman filter demo.', 'duration': 42.898, 'max_score': 63.067, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX863067.jpg'}, {'end': 187.897, 'src': 'embed', 'start': 122.552, 'weight': 0, 'content': [{'end': 132.221, 'text': "But for now we're going to look at this gantry crane configuration where the pendulum is in the down position and all we're going to be looking at is the pendulum essentially moving,", 'start': 122.552, 'duration': 9.669}, {'end': 136.024, 'text': 'the cart moving left and right and the pendulum swinging about in the down position.', 'start': 132.221, 'duration': 3.803}, {'end': 142.651, 'text': "So this is stable, observable, and that's how I'm going to demonstrate the Kalman filter.", 'start': 136.925, 'duration': 5.726}, {'end': 151.014, 'text': "Another thing that I think is important is I'm actually going to demonstrate the Kalman filter on the linearized dynamics,", 'start': 144.351, 'duration': 6.663}, {'end': 154.415, 'text': "so I'm really going to only simulate this linear dynamical system.", 'start': 151.014, 'duration': 3.401}, {'end': 161.337, 'text': 'It is possible to use that and then apply it to estimate the state in the full nonlinear system,', 'start': 155.675, 'duration': 5.662}, {'end': 164.298, 'text': "but it's a little bit easier in MATLAB to show you everything on the linear system.", 'start': 161.337, 'duration': 2.961}, {'end': 173.365, 'text': 'So again, when we combine LQR regulator, full state feedback and the Kalman filter estimator, when we combine those,', 'start': 164.998, 'duration': 8.367}, {'end': 176.748, 'text': "then we're going to actually work with the full nonlinear system.", 'start': 173.365, 'duration': 3.383}, {'end': 180.791, 'text': "But for now, we're going to look at the linearized dynamics about the down position.", 'start': 177.548, 'duration': 3.243}, {'end': 184.454, 'text': 'So here I have my basic code.', 'start': 182.252, 'duration': 2.202}, {'end': 185.855, 'text': "I'm defining the parameters.", 'start': 184.474, 'duration': 1.381}, {'end': 187.897, 'text': "We're looking at the pendulum down solution.", 'start': 185.875, 'duration': 2.022}], 'summary': 'Demonstrating kalman filter on linearized dynamics and pendulum motion.', 'duration': 65.345, 'max_score': 122.552, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX8122552.jpg'}], 'start': 3.51, 'title': 'Kalman filter in dynamics', 'summary': 'Covers the development and application of kalman filter in estimating the state of inverted pendulum and control systems, highlighting its limitations and the need for combining with lqr regulator, demonstrated through various configurations and dynamics in matlab.', 'chapters': [{'end': 62.787, 'start': 3.51, 'title': 'Kalman filter for inverted pendulum', 'summary': 'Discusses the development of a kalman filter to estimate the full state of an inverted pendulum on a cart from a single measurement, and mentions the difficulty in demonstrating the kalman filter for the pendulum in the up position due to its instability.', 'duration': 59.277, 'highlights': ['Developing a Kalman filter to estimate the full state of the inverted pendulum on a cart from a single measurement y.', 'Demonstrating the difficulty of using a Kalman filter for the unstable system of the pendulum in the up position.']}, {'end': 142.651, 'start': 63.067, 'title': 'Kalman filter for pendulum control', 'summary': "Discusses the limitations of using a linearized model for estimating the pendulum's behavior when starting in the up position and emphasizes the need to combine the kalman filter and lqr regulator for stabilizing the system, while also highlighting the demonstration of the kalman filter using a stable and observable gantry crane configuration with the pendulum in the down position.", 'duration': 79.584, 'highlights': ['The linearized model is only valid near the equilibrium where the pendulum is up, but it rapidly becomes invalid as the pendulum falls down, highlighting the limitations of the linearized model (unstable behavior).', 'Emphasizes the necessity of combining the Kalman filter and LQR regulator to stabilize the system when observing the pendulum in the up position (stability requirement).', 'Demonstrating the Kalman filter using a stable and observable gantry crane configuration with the pendulum in the down position, allowing the cart to move left and right and the pendulum to swing about (stable and observable setup).']}, {'end': 187.897, 'start': 144.351, 'title': 'Kalman filter on linearized dynamics', 'summary': 'Discusses the use of kalman filter on linearized dynamics to demonstrate a linear dynamical system in matlab, before working with the full nonlinear system, combining lqr regulator, full state feedback, and kalman filter estimator.', 'duration': 43.546, 'highlights': ['The chapter demonstrates the Kalman filter on the linearized dynamics to simulate the linear dynamical system.', 'The chapter explains that it is easier in MATLAB to show everything on the linear system before working with the full nonlinear system.', 'The author mentions that the combination of LQR regulator, full state feedback, and Kalman filter estimator allows working with the full nonlinear system.']}], 'duration': 184.387, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX83510.jpg', 'highlights': ['Demonstrating the Kalman filter using a stable and observable gantry crane configuration with the pendulum in the down position, allowing the cart to move left and right and the pendulum to swing about (stable and observable setup).', 'Developing a Kalman filter to estimate the full state of the inverted pendulum on a cart from a single measurement y.', 'Emphasizes the necessity of combining the Kalman filter and LQR regulator to stabilize the system when observing the pendulum in the up position (stability requirement).', 'The chapter demonstrates the Kalman filter on the linearized dynamics to simulate the linear dynamical system.', 'The author mentions that the combination of LQR regulator, full state feedback, and Kalman filter estimator allows working with the full nonlinear system.', 'The linearized model is only valid near the equilibrium where the pendulum is up, but it rapidly becomes invalid as the pendulum falls down, highlighting the limitations of the linearized model (unstable behavior).', 'Demonstrating the difficulty of using a Kalman filter for the unstable system of the pendulum in the up position.', 'The chapter explains that it is easier in MATLAB to show everything on the linear system before working with the full nonlinear system.']}, {'end': 353.5, 'segs': [{'end': 247.224, 'src': 'embed', 'start': 217.154, 'weight': 1, 'content': [{'end': 221.82, 'text': "Good Now to build a Kalman filter, there's a few extra steps that I need.", 'start': 217.154, 'duration': 4.666}, {'end': 232.064, 'text': "We're going to essentially be building an augmented system that essentially has disturbances and noise.", 'start': 223.201, 'duration': 8.863}, {'end': 234.605, 'text': "Okay, so I'm going to draw the system the following way.", 'start': 232.444, 'duration': 2.161}, {'end': 247.224, 'text': "So I'm going to have my system That's essentially x dot equals ax plus bu.", 'start': 238.107, 'duration': 9.117}], 'summary': 'Building a kalman filter with an augmented system for x dot equals ax plus bu.', 'duration': 30.07, 'max_score': 217.154, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX8217154.jpg'}, {'end': 353.5, 'src': 'embed', 'start': 296.722, 'weight': 0, 'content': [{'end': 309.43, 'text': "and it's also going to take this u, and our Kalman filter is going to build an estimate of the full state x-hat, and this means vector x.", 'start': 296.722, 'duration': 12.708}, {'end': 315.754, 'text': "it's this whole state of position, velocity, position, velocity of the cart and the pendulum.", 'start': 309.43, 'duration': 6.324}, {'end': 321.422, 'text': "okay, so this is what our Kalman filter is going to do, And so there's a few things I have to define.", 'start': 315.754, 'duration': 5.668}, {'end': 328.926, 'text': 'So first of all, VD is a matrix of disturbance covariances.', 'start': 321.702, 'duration': 7.224}, {'end': 337.391, 'text': "And essentially what I'm going to say is that these disturbances have essentially magnitude 0.1 times the identity matrix.", 'start': 329.427, 'duration': 7.964}, {'end': 345.034, 'text': 'So they all enter each of these states equally, 0.1 times disturbance, 0.1 times disturbance, 0.1, 0.1.', 'start': 337.851, 'duration': 7.183}, {'end': 353.5, 'text': 'If I wanted to make it so that the theta dot had a lot bigger disturbances, I would just take that element, the 4x4 element of this matrix,', 'start': 345.035, 'duration': 8.465}], 'summary': 'Kalman filter estimates full state x-hat with disturbance covariances of magnitude 0.1.', 'duration': 56.778, 'max_score': 296.722, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX8296722.jpg'}], 'start': 187.917, 'title': 'Building kalman filter for system augmentation', 'summary': 'Discusses the process of building an augmented system with disturbances and noise, and the use of kalman filter to estimate the full state of the system, including defining disturbance covariances and their magnitudes.', 'chapters': [{'end': 353.5, 'start': 187.917, 'title': 'Building kalman filter for system augmentation', 'summary': 'Discusses the process of building an augmented system with disturbances and noise, and the use of kalman filter to estimate the full state of the system, including defining disturbance covariances and their magnitudes.', 'duration': 165.583, 'highlights': ['The Kalman filter is used to build an estimate of the full state of the system, including position, velocity, and disturbances, with a defined disturbance covariances matrix VD.', 'The process involves adding disturbances and noise to the system, and using the Kalman filter to estimate the full state x-hat, which is the whole state of position, velocity, position, velocity of the cart and the pendulum.', 'The disturbances are defined by a matrix of disturbance covariances (VD), where each disturbance has a magnitude of 0.1 times the identity matrix, equally affecting each state.']}], 'duration': 165.583, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX8187917.jpg', 'highlights': ['The Kalman filter estimates the full state of the system, including disturbances, with a defined covariances matrix VD.', 'The process involves adding disturbances and noise, and using the Kalman filter to estimate the full state x-hat.', 'Disturbances are defined by a matrix of covariances (VD), each with a magnitude of 0.1 times the identity matrix.']}, {'end': 640.479, 'segs': [{'end': 418.545, 'src': 'embed', 'start': 395.549, 'weight': 0, 'content': [{'end': 402.734, 'text': "But if I think I have really nasty big sensor noise, I have really noisy sensors, I'm going to make this VN larger than VD.", 'start': 395.549, 'duration': 7.185}, {'end': 411.1, 'text': "And the ratio of those tells me kind of how this Kalman filter is going to balance its model of the system with the measurements it's getting from Y.", 'start': 403.034, 'duration': 8.066}, {'end': 417.324, 'text': "Okay? Okay, so now what we're going to do is build this augmented system.", 'start': 411.1, 'duration': 6.224}, {'end': 418.545, 'text': "I'm calling this BF.", 'start': 417.344, 'duration': 1.201}], 'summary': 'To balance the kalman filter, increase vn over vd.', 'duration': 22.996, 'max_score': 395.549, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX8395549.jpg'}, {'end': 552.783, 'src': 'embed', 'start': 485.771, 'weight': 2, 'content': [{'end': 492.635, 'text': 'And so notice here in the B matrix now for my bigger system where my inputs are U, D, and N.', 'start': 485.771, 'duration': 6.864}, {'end': 496.717, 'text': 'So U, D, and N are inputs for my larger system.', 'start': 492.635, 'duration': 4.082}, {'end': 506.782, 'text': 'If I want to draw a box around this, then this is my augmented system.', 'start': 497.837, 'duration': 8.945}, {'end': 511.987, 'text': 'Then the B matrix now is B.', 'start': 508.604, 'duration': 3.383}, {'end': 517.991, 'text': 'It takes in inputs U, it takes in inputs D, and it takes in inputs N.', 'start': 511.987, 'duration': 6.004}, {'end': 529.942, 'text': "And similarly, my C matrix is just, I'm measuring the cart position, but my new D matrix, this feed-through term, this is essentially my D term.", 'start': 517.991, 'duration': 11.951}, {'end': 535.066, 'text': "So it's D equals zero, zero, VN.", 'start': 530.002, 'duration': 5.064}, {'end': 544.318, 'text': 'times my input, which is U, D, and N.', 'start': 538.214, 'duration': 6.104}, {'end': 552.783, 'text': 'Okay, so I can build this big augmented state space system that essentially takes in disturbances, inputs, and noise.', 'start': 544.318, 'duration': 8.465}], 'summary': 'The augmented system takes inputs u, d, and n and measures cart position, with d being the feed-through term for disturbances, and it accounts for noise, forming a big state space system.', 'duration': 67.012, 'max_score': 485.771, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX8485771.jpg'}, {'end': 640.479, 'src': 'embed', 'start': 578.889, 'weight': 1, 'content': [{'end': 587.274, 'text': "I'm also going to simulate this truth system, this full state output system, so that I can compare my estimated state with the true state.", 'start': 578.889, 'duration': 8.385}, {'end': 589.435, 'text': 'It seems like a lot.', 'start': 588.555, 'duration': 0.88}, {'end': 591.576, 'text': 'It actually is kind of a pain to code this up.', 'start': 589.495, 'duration': 2.081}, {'end': 597.319, 'text': "It would almost be easier to just build this Kalman filter for a real experiment where I didn't have to code all this.", 'start': 592.056, 'duration': 5.263}, {'end': 601.562, 'text': 'But to show you in MATLAB, I want to actually add disturbances and noise.', 'start': 598.36, 'duration': 3.202}, {'end': 603.904, 'text': "Okay, so I'm going to run this code.", 'start': 602.102, 'duration': 1.802}, {'end': 605.266, 'text': "Let's hope there's no errors.", 'start': 603.924, 'duration': 1.342}, {'end': 606.288, 'text': 'Okay, good.', 'start': 605.787, 'duration': 0.501}, {'end': 612.536, 'text': 'So now I have my system with a limited measurement and I also have my truth system with the full state output measurement.', 'start': 606.328, 'duration': 6.208}, {'end': 616.361, 'text': "And I've augmented my system to include disturbances and noise.", 'start': 613.177, 'duration': 3.184}, {'end': 621.674, 'text': "Okay, so now the next part's actually pretty straightforward.", 'start': 617.893, 'duration': 3.781}, {'end': 623.455, 'text': "We're going to actually build a Kalman filter.", 'start': 621.694, 'duration': 1.761}, {'end': 626.075, 'text': "And there's two ways of doing this.", 'start': 624.635, 'duration': 1.44}, {'end': 628.756, 'text': "I actually like the second way better, but I'll show you both.", 'start': 626.255, 'duration': 2.501}, {'end': 632.817, 'text': "So in MATLAB, there's a command called LQE.", 'start': 629.596, 'duration': 3.221}, {'end': 635.398, 'text': 'This stands for Linear Quadratic Estimator.', 'start': 632.877, 'duration': 2.521}, {'end': 640.479, 'text': 'And it basically gives you a Kalman filter, but you have to give it a bunch of inputs.', 'start': 636.678, 'duration': 3.801}], 'summary': 'Simulated kalman filter in matlab with disturbances and noise for state estimation.', 'duration': 61.59, 'max_score': 578.889, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX8578889.jpg'}], 'start': 353.5, 'title': 'Tuning knobs and building augmented state space system', 'summary': 'Discusses the use of vd and vn matrices to balance model uncertainty and sensor noise in the kalman filter, and creating an augmented system by adding disturbance and noise terms. it also introduces building an augmented state space system with b and c matrices and simulating a truth system for comparison in matlab.', 'chapters': [{'end': 484.411, 'start': 353.5, 'title': 'Tuning knobs and augmented system', 'summary': 'Discusses the use of tuning knobs such as vd and vn matrices to balance model uncertainty and sensor noise in the kalman filter, and the creation of an augmented system by adding disturbance and noise terms to the state and measurement equations.', 'duration': 130.911, 'highlights': ['The VD and VN matrices act as tuning knobs to balance model uncertainty and sensor noise in the Kalman filter.', 'Creation of an augmented system by adding disturbance and noise terms to the state and measurement equations.']}, {'end': 640.479, 'start': 485.771, 'title': 'Building augmented state space system', 'summary': 'Introduces the concept of building an augmented state space system, including the b matrix for inputs u, d, and n, the c matrix for measuring cart position, and the simulation of a truth system for comparing estimated state with the true state in matlab.', 'duration': 154.708, 'highlights': ['The B matrix is augmented to take in inputs U, D, and N for the larger system.', 'The C matrix measures the cart position and the new D matrix represents the feed-through term.', 'The simulation includes the comparison of the estimated state with the true state using the full state output system.', 'The process of building a Kalman filter in MATLAB using the LQE command is discussed.']}], 'duration': 286.979, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX8353500.jpg', 'highlights': ['The VD and VN matrices balance model uncertainty and sensor noise in the Kalman filter.', 'Creation of an augmented system by adding disturbance and noise terms.', 'The B matrix is augmented to take in inputs U, D, and N for the larger system.', 'The C matrix measures the cart position and the new D matrix represents the feed-through term.', 'The simulation includes the comparison of the estimated state with the true state using the full state output system.', 'Building a Kalman filter in MATLAB using the LQE command is discussed.']}, {'end': 969.988, 'segs': [{'end': 702.331, 'src': 'embed', 'start': 664.375, 'weight': 0, 'content': [{'end': 673.457, 'text': "And what you get out, I should probably just call this, instead of L, let's call it KF, the Kalman filter gain.", 'start': 664.375, 'duration': 9.082}, {'end': 683.18, 'text': "And let's say, okay, I'll have to change everything down here too.", 'start': 674.378, 'duration': 8.802}, {'end': 689.453, 'text': 'Okay, one more place.', 'start': 688.612, 'duration': 0.841}, {'end': 697.584, 'text': 'Okay, but essentially what this outputs is the Kalman filter gain matrix,', 'start': 690.795, 'duration': 6.789}, {'end': 702.331, 'text': 'essentially the matrix that allows me to place the eigenvalues of my estimator.', 'start': 697.584, 'duration': 4.747}], 'summary': 'The kalman filter outputs the gain matrix for placing estimator eigenvalues.', 'duration': 37.956, 'max_score': 664.375, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX8664375.jpg'}, {'end': 755.766, 'src': 'embed', 'start': 729.675, 'weight': 1, 'content': [{'end': 736.658, 'text': 'what I get out are my Kalman filter gains just using this LQR optimization.', 'start': 729.675, 'duration': 6.983}, {'end': 737.478, 'text': "So it's really cool.", 'start': 736.758, 'duration': 0.72}, {'end': 744.921, 'text': 'Basically, LQR and LQE are solving the same fundamental equations just in some kind of a transposed notation.', 'start': 737.498, 'duration': 7.423}, {'end': 753.505, 'text': 'So I just want to show you that you can kind of hijack the code from the LQR command and use that to compute this optimal Kalman filter,', 'start': 744.961, 'duration': 8.544}, {'end': 755.766, 'text': 'as long as you transpose things correctly.', 'start': 754.025, 'duration': 1.741}], 'summary': 'Kalman filter gains computed using lqr optimization, transposing equations for lqe.', 'duration': 26.091, 'max_score': 729.675, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX8729675.jpg'}, {'end': 882.879, 'src': 'embed', 'start': 861.792, 'weight': 3, 'content': [{'end': 872.104, 'text': "So now the last thing we're going to look at is we're actually going to simulate the system in the down position and I'm going to give it noisy measurements and disturbances and I'm going to kick it,", 'start': 861.792, 'duration': 10.312}, {'end': 875.889, 'text': "and then we're going to see how well our Kalman filter estimated all of these states.", 'start': 872.104, 'duration': 3.785}, {'end': 882.879, 'text': "Okay, so again, this is, you know, I'm cooking up an example to show you all of the pieces.", 'start': 876.817, 'duration': 6.062}], 'summary': 'Simulated system in down position, tested kalman filter estimation.', 'duration': 21.087, 'max_score': 861.792, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX8861792.jpg'}, {'end': 928.068, 'src': 'embed', 'start': 903.388, 'weight': 4, 'content': [{'end': 912.369, 'text': "In the real world, I'm just going to have measurements of u and y, and I'm going to be building x hat using my model of the system.", 'start': 903.388, 'duration': 8.981}, {'end': 915.471, 'text': 'All of this stuff is just for my demo.', 'start': 913.089, 'duration': 2.382}, {'end': 919.414, 'text': "I'm just simulating what the system is doing with disturbances and noise for the demo.", 'start': 915.951, 'duration': 3.463}, {'end': 928.068, 'text': "Okay, so I'm gonna simulate from time equals 0.01 to 50 in increments of 0.01.", 'start': 920.979, 'duration': 7.089}], 'summary': 'Building x hat using model for demo, simulating from time 0.01 to 50.', 'duration': 24.68, 'max_score': 903.388, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX8903388.jpg'}], 'start': 640.499, 'title': 'Kalman filter for system estimation', 'summary': 'Discusses the use of kalman filter for system estimation, covering the implementation, disturbance and noise covariances, building the kalman filter gain matrix, simulating the system, and evaluating the estimation of system states.', 'chapters': [{'end': 775.699, 'start': 640.499, 'title': 'Kalman filter and lqr command', 'summary': 'Discusses the use of kalman filter gain matrix, obtained from the a matrix, disturbance, measurement matrix c, and noise covariances, and the ability to utilize the lqr command to compute the optimal kalman filter gains, showing that lqr and lqe solve the same fundamental equations in a transposed notation.', 'duration': 135.2, 'highlights': ['The Kalman filter gain matrix is obtained from the A matrix, disturbance, measurement matrix C, and noise covariances, allowing the placement of the eigenvalues of the estimator.', 'The LQR command can be used with transposed notation of A and C matrices to compute the optimal Kalman filter gains, demonstrating that LQR and LQE solve the same fundamental equations.', 'The chapter highlights the ability to use the LQR command for computing the optimal Kalman filter, leveraging familiarity with the command and transposing correctly.']}, {'end': 969.988, 'start': 777.594, 'title': 'Kalman filter for system estimation', 'summary': "Covers the implementation of a kalman filter for system estimation, including defining disturbance and noise covariances, building the kalman filter gain matrix, simulating the system with disturbances and noise, and evaluating the kalman filter's estimation of system states.", 'duration': 192.394, 'highlights': ['The chapter covers the implementation of a Kalman filter for system estimation', 'Simulating the system with disturbances and noise', 'Building the Kalman filter gain matrix']}], 'duration': 329.489, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX8640499.jpg', 'highlights': ['The Kalman filter gain matrix is obtained from the A matrix, disturbance, measurement matrix C, and noise covariances, allowing the placement of the eigenvalues of the estimator.', 'The LQR command can be used with transposed notation of A and C matrices to compute the optimal Kalman filter gains, demonstrating that LQR and LQE solve the same fundamental equations.', 'The chapter highlights the ability to use the LQR command for computing the optimal Kalman filter, leveraging familiarity with the command and transposing correctly.', 'The chapter covers the implementation of a Kalman filter for system estimation', 'Simulating the system with disturbances and noise', 'Building the Kalman filter gain matrix']}, {'end': 1328.085, 'segs': [{'end': 1024.237, 'src': 'embed', 'start': 970.068, 'weight': 1, 'content': [{'end': 972.909, 'text': 'So my cart should lurch forward and then lurch backward.', 'start': 970.068, 'duration': 2.841}, {'end': 978.292, 'text': "Then I'm building this big augmented input that's going to go into here.", 'start': 974.61, 'duration': 3.682}, {'end': 982.665, 'text': 'And then all I have to do is simulate the system.', 'start': 980.884, 'duration': 1.781}, {'end': 991.729, 'text': "I'm going to simulate my system using this lsim command with this big input that has my actual actuation, my disturbance, and my noise.", 'start': 982.685, 'duration': 9.044}, {'end': 994.13, 'text': "So let's just plot that.", 'start': 993.269, 'duration': 0.861}, {'end': 1000.693, 'text': 'Okay, so this whole thing runs.', 'start': 999.432, 'duration': 1.261}, {'end': 1003.272, 'text': 'And this is kind of cool.', 'start': 1002.372, 'duration': 0.9}, {'end': 1009.594, 'text': 'What we see is this is time on the x-axis and the y-axis is my measurement y.', 'start': 1003.492, 'duration': 6.102}, {'end': 1019.816, 'text': "And you'll see this is a big fuzzy measurement of y that is essentially, you know, the cart is lurching forward and then lurching backward.", 'start': 1009.594, 'duration': 10.222}, {'end': 1021.516, 'text': "Okay, that's what we thought was going to happen.", 'start': 1019.836, 'duration': 1.68}, {'end': 1024.237, 'text': "But there's a ton of measurement noise on top of this.", 'start': 1021.876, 'duration': 2.361}], 'summary': 'Simulation shows cart lurching forward and backward as expected with measurement noise.', 'duration': 54.169, 'max_score': 970.068, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX8970068.jpg'}, {'end': 1177.824, 'src': 'embed', 'start': 1153.687, 'weight': 0, 'content': [{'end': 1160.751, 'text': 'And so you see that the black dashed curve almost perfectly lies on top of this red true underlying cart position.', 'start': 1153.687, 'duration': 7.064}, {'end': 1167.917, 'text': 'And so our Kalman filter is doing a great job of squashing that noise and really estimating the true underlying signature.', 'start': 1161.292, 'duration': 6.625}, {'end': 1169.698, 'text': "Okay, so that's very promising.", 'start': 1167.937, 'duration': 1.761}, {'end': 1175.542, 'text': 'But remember, our Kalman filter is not just supposed to denoise our measurements y.', 'start': 1170.398, 'duration': 5.144}, {'end': 1177.824, 'text': "we also want to know what's happening with all the variables.", 'start': 1175.542, 'duration': 2.282}], 'summary': 'Kalman filter effectively reduces noise in estimating true underlying signature, showing promising results.', 'duration': 24.137, 'max_score': 1153.687, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX81153687.jpg'}, {'end': 1281.952, 'src': 'embed', 'start': 1254.924, 'weight': 3, 'content': [{'end': 1261.328, 'text': 'x dot the position and velocity of the cart and theta and theta dot the position and velocity of the pendulum,', 'start': 1254.924, 'duration': 6.404}, {'end': 1264.911, 'text': 'just using a single noisy measurement of the cart, position y.', 'start': 1261.328, 'duration': 3.583}, {'end': 1269.764, 'text': 'So this gives you an idea of how powerful the Kalman filter is.', 'start': 1266.702, 'duration': 3.062}, {'end': 1275.107, 'text': 'Even if I only measured one variable I just measured the cart position.', 'start': 1270.424, 'duration': 4.683}, {'end': 1281.952, 'text': "I'm able to back out the position and velocity of all of my components of my system using the Kalman filter.", 'start': 1275.107, 'duration': 6.845}], 'summary': 'Kalman filter enables estimation of all system components from single noisy measurement.', 'duration': 27.028, 'max_score': 1254.924, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX81254924.jpg'}, {'end': 1326.325, 'src': 'heatmap', 'start': 1292.771, 'weight': 5, 'content': [{'end': 1298.16, 'text': "And what we're going to do finally is we're going to use that for closed-loop feedback.", 'start': 1292.771, 'duration': 5.389}, {'end': 1302.007, 'text': "We're going to say u equals minus k x-hat.", 'start': 1298.18, 'duration': 3.827}, {'end': 1303.589, 'text': "We're going to use our LQR.", 'start': 1302.047, 'duration': 1.542}, {'end': 1313.802, 'text': "and we're going to feed that back as an input to our system, and we're going to actually simulate the full nonlinear inverted pendulum on a cart.", 'start': 1305.12, 'duration': 8.682}, {'end': 1319.303, 'text': 'So this whole part here is going to be an actual simulation of the real nonlinear system.', 'start': 1314.662, 'duration': 4.641}, {'end': 1326.325, 'text': "We're going to use our Kalman filter to estimate the full state, and then we're going to use that to feed back into our LQR regulator.", 'start': 1319.843, 'duration': 6.482}], 'summary': 'Using lqr and kalman filter for closed-loop feedback in simulating nonlinear inverted pendulum on a cart.', 'duration': 33.554, 'max_score': 1292.771, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX81292771.jpg'}], 'start': 970.068, 'title': 'Simulating system response and kalman filter', 'summary': 'Discusses simulating system response with augmented input and noise, while also explaining the use of kalman filter to estimate system state and variables, leading to closed-loop feedback with an lqr regulator.', 'chapters': [{'end': 1024.237, 'start': 970.068, 'title': 'Simulating system response with augmented input', 'summary': 'Discusses simulating system response using a big augmented input, with actual actuation, disturbance, and noise, resulting in a fuzzy measurement of cart movement with significant noise.', 'duration': 54.169, 'highlights': ['The simulation involves using a big augmented input that contains actual actuation, disturbance, and noise.', 'The resulting measurement of cart movement is fuzzy, with significant noise on top of the expected lurching forward and backward.', 'The plot displays time on the x-axis and the measurement y on the y-axis, showing the expected lurching motion of the cart with a notable presence of measurement noise.']}, {'end': 1328.085, 'start': 1025.619, 'title': 'Kalman filter for system estimation', 'summary': "Explains the process of using a kalman filter to estimate the true underlying state of a system, showcasing its ability to accurately estimate the system's true state and variables using noisy measurements, ultimately leading to closed-loop feedback utilizing an lqr regulator.", 'duration': 302.466, 'highlights': ['The Kalman filter accurately estimates the true underlying state of the system by squashing noise and effectively estimating the true underlying signature.', 'The Kalman filter is able to accurately estimate the position and velocity of all components of the system, including the cart position, velocity, and the position and velocity of the pendulum, using only a single noisy measurement of the cart position.', 'The chapter concludes with the plan to use the Kalman filter estimate for closed-loop feedback, incorporating an LQR regulator to simulate the full nonlinear inverted pendulum on a cart.']}], 'duration': 358.017, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Lgq4R-F8SX8/pics/Lgq4R-F8SX8970068.jpg', 'highlights': ['The Kalman filter accurately estimates the true underlying state of the system by squashing noise and effectively estimating the true underlying signature.', 'The simulation involves using a big augmented input that contains actual actuation, disturbance, and noise.', 'The resulting measurement of cart movement is fuzzy, with significant noise on top of the expected lurching forward and backward.', 'The Kalman filter is able to accurately estimate the position and velocity of all components of the system, including the cart position, velocity, and the position and velocity of the pendulum, using only a single noisy measurement of the cart position.', 'The plot displays time on the x-axis and the measurement y on the y-axis, showing the expected lurching motion of the cart with a notable presence of measurement noise.', 'The chapter concludes with the plan to use the Kalman filter estimate for closed-loop feedback, incorporating an LQR regulator to simulate the full nonlinear inverted pendulum on a cart.']}], 'highlights': ['The Kalman filter accurately estimates the true underlying state of the system by squashing noise and effectively estimating the true underlying signature.', 'The Kalman filter estimates the full state of the system, including disturbances, with a defined covariances matrix VD.', 'The VD and VN matrices balance model uncertainty and sensor noise in the Kalman filter.', 'The process involves adding disturbances and noise, and using the Kalman filter to estimate the full state x-hat.', 'The Kalman filter is able to accurately estimate the position and velocity of all components of the system, including the cart position, velocity, and the position and velocity of the pendulum, using only a single noisy measurement of the cart position.', 'The chapter covers the implementation of a Kalman filter for system estimation', 'The chapter demonstrates the Kalman filter on the linearized dynamics to simulate the linear dynamical system.', 'The Kalman filter gain matrix is obtained from the A matrix, disturbance, measurement matrix C, and noise covariances, allowing the placement of the eigenvalues of the estimator.', 'The chapter concludes with the plan to use the Kalman filter estimate for closed-loop feedback, incorporating an LQR regulator to simulate the full nonlinear inverted pendulum on a cart.', 'The linearized model is only valid near the equilibrium where the pendulum is up, but it rapidly becomes invalid as the pendulum falls down, highlighting the limitations of the linearized model (unstable behavior).']}