Lesson finished
Up next: Laplace Transforms and Deriving a Transfer Function in Simulink
Unlock all 58 lessons of Autonomous Vehicle Controls using MATLAB and SimulinkFull course ₹40,000 · paid
System Modeling and the Basics of a Feedback Control System
A free lesson from Skill-Lync's Autonomous Vehicle Controls using MATLAB and Simulink course, on Grow by Skill-Lync · Last updated 16 Nov 2026 · Session: “Week 1 Session 2”
What will you learn in this free Autonomous Vehicle Controls using MATLAB and Simulink lesson?
The lesson shows how a real dynamic system, such as a car suspension, is modeled as masses, springs and dampers with mathematical equations. It then explains the parts of a control system: reference, comparison, controller, plant, correction and measurement.
- Modeling a suspension as a spring-mass-damper system
- Why models help control design and simulation
- Controller, plant and measurement feedback loop
- Error between reference and actual vehicle speed
What comes after lesson 2?
The next free lesson is lesson 3, “Laplace Transforms and Deriving a Transfer Function in Simulink” (16 min). Later in Skill-Lync's Autonomous Vehicle Controls using MATLAB and Simulink course (paid): lesson 4, Week 1 Session 4; lesson 5, Week 1 Session 5; lesson 6, Week 1 Session 6. The full course has 58 lessons (24 h 4 min of video); see the course overview or its price and syllabus.
Lesson transcript
Machine transcript of the lesson audio (lightly cleaned). Technical terms may contain errors; the video is the reference.
Hello, welcome to the second session of week one. In the last session, we learned about the basics of automotive control systems, and we talked a little bit about how this course is going to progress and what are the things to focus on. In this session, we'll start with our control system knowledge, and we'll start with system modeling, which is the fundamental start point of designing a control system. So let's get started. System modeling is a concept where we try to represent a real-life dynamic system in the form of mathematical equations, and this is often the first point where we start designing a control system.
A control system is nothing but a set of mathematical equations, and we perform a bunch of calculations using those equations, but the question is where the equations come from, and this is the part where we do system modeling. System modeling. Let's take an example of a car, which is our dynamic system in this case, and I'm a suspension engineer who wants to get a model for the rear tire suspension, and what I can do is I can represent the different dynamic motions in form of different dynamic systems.
systems. For example, I can represent the entire mass of the car in the form of one mass, and I can represent the tire mass in the form of another mass, and between these contact points, I can represent in the form of a spring and a damper system. system. For example, the this would be my area of interest because this is basically your suspension system, and this would be the tire contact with the road surface, and the advantage of doing this modeling system is that now I can create a mathematical equation of this particular system and this particular system.
system. And as you can see, the output of the first system is acts as an input of the second system, and I can perform different calculations on the first system, and I can see the effect happening on the second system. system. So in this case, this will be my first system, and this will be the second set of system. In the next slide, we'll see how to generate the mathematical model. But to give you a general idea, by doing this, we have essentially connected all these moving components of this suspension model in the form of a mathematical equation. And now we are free to do different analysis and different types of control activities on it. This sort of modeling is pretty common while designing any kind of vehicle dynamics systems. And for a long time, many engineers have been performing this sort of modeling to develop different simulation models to see and learn how the dynamic system reacts to a different input. As you can see, this is a basic example of how we can model all the different wheels in the form of a spring mass damper system. And the more masses you add, and the more systems you add, the closer you get to the real life reaction of this dynamic system. For example, if I were to model it, make this model more complex, I could add another model of a driver in the form of a spring mass damper system. And I can calculate the amount of vibration felt in the same way that it would be used to be used to be used by the driver on this particular road system. So this is a really helpful tool, which is not only used in control systems, but also to study and different fields in in vehicle dynamics, such as noise vibrations, and different types of feedback analysis. Now, in a modern day in the industry, we don't really go and do all this basic modeling. There are different softwares and different mathematical simulation tools such as Amesim and Lotus Lotus Shark. And these are different software companies who have essentially created pre-built models using these concepts, and have already created a very good software out of it. So all you have to do is mention, like assemble a set of blocks and assemble a number of masses you need for this system. And the software could generate the system model for you. However, it's good to know the basics. And we'll see how we will apply this knowledge in designing our adaptive cruise control and lane centering sort of features in the future. But for now, you can say that a system modeling approach helps you generate mathematical equations that can be used to calculate control variables. Now you may ask what are control variables. So control variables are nothing but as a designer, we can control so that we can receive a definite desired outcome.
And to give you a simple example, imagine this was adaptive suspension system. Now what an adaptive suspension system does is, let's say you are in a Mercedes Benz, and on a city road, you would like to perform it as a city car. But if you are going on a race track, you would like to have the performance of a race car. And the way you can do is often race car would have to do very high speed corners on the track. So you would have to have a more stiffer suspension. So what you can do is the driver can control sports mode. So once the select sports mode in the car, we can manipulate the variables that is like the suspension coefficient and the damping coefficient of the suspension system.
And that way the car will behave differently on different types of modes. In that case, the suspension constant will be my control variable. And I will change this variable depending on the type of performance I need from the control system. So that was a quick example of how we can use a mathematical equation and study the difference in the control variables. So let's start with an example of a simple dynamic system. I have taken a simple spring mass damper system. And as you can see, we can assume that this system is only able to move in the horizontal direction and there is no friction or air drag in the system.
So we can see that there is no friction or air drag in the system. So we can see that there is an input force which has been applied and there is a spring and a damper which is connected to the mass. And let's say the mass. And let's say the mass is traveled for x distance. Now we can go and model the system. And it's very simple by using Newton's second law, which is sum of all forces is equal to mass and acceleration. We can model the system. So we start by drawing a free body diagram of a mass.
So in this case, we already know there is an input force F and there is a resistance force on the opposite direction from the spring that is Kx and Bx dot. B is the damping coefficient, which should be multiplied with the velocity. So now that you have your free body diagram complete, let's form it into equations. So let's start by summing all the forces. I'm going to assume that this is positive X direction and that is Y direction. So in that sense, our equation can be written as right.
So we have F minus K times X minus B times X dot. And this will be equal to the mass and the acceleration. So that is mass and acceleration X double dot. So this is a simple dynamic equation. And as you can see, it's a second order differential equation. Second order because they have a dx double derivative of X. So now we have this equation. And what I can do is I can divide my entire equation since I'm interested more in the acceleration. I can divide the entire equation by a constant one by n.
And once we have this mathematical equation, the next step is to model it. And we'll be using Simulink to model this simple dynamic system. So let's go ahead and open MATLAB and Simulink. So here I go. I have my MATLAB open. I have already created a simple script. You can do that by selecting a new script and you can save it and give whatever name you have. I have given it a name of week one. After that, you can. It's a good practice to always clear your workspace and your variables.
So you can have that CLC and clear all command. And here I have mentioned all my model parameters. So in my model. So I have defined a simulation time of 15 seconds with this variable SimTime. And I can define my. Variables as mass, damping coefficient, and the spring coefficient as 10, 10, 20. So once you have loaded a returner, you can go hit and run. So now you can see all my variables out in the workspace. So the next step would be to open a Simulink model. You can go to open a Simulink model by going into home and click Simulink or you can just simply go ahead and type Simulink in the workspace.
So once you have opened your Simulink, remember after you can screenshot of the equation which you want to build. So this is the equation which we want to model. So let's start by going to the library. So once you have the library open, you can search for different blocks which you would need. The simpler way to do it in MATLAB 2020B is to just type or start click anywhere on the workspace and start typing. So let's see what we have. Our output should be the acceleration.
And all this on the right hand side, I will start modeling by using those equations first. So let's go and add a add block. Now I need one positive and two negative signs. So I'll go and change this. And in this case, my input is force F. So I can simulate a force in Simulink by using a step function. So click step function. The other way to of course search is you can go to library and go to sources. And there you go. You have different types of sources and you can select whatever source you want and drag and drop. So once I have my force, I'm going to change the variable name. And let's say my final value of the force should be 2 kN. And let's go and connect this. All the outputs of this summation operation should be multiplied by a constant of 1 by n. So I'm going to add a constant gain block. And we can change the variable as 1 by n. So once I have my gain again, the output of this will be the acceleration. So we can name this as x dot dot. And let's say we need a sync for our model.
And we can go to library and go to sync. Let's say in this case, I want to visualize my output so I can drag and drop a scope block. So remember, we need a accelerate. So we already have acceleration. We need something as velocity and the displacement. And if we integrate acceleration once, we can get velocity. And if we integrate it twice, we can get displacement. So let's go ahead and do that. So for now, I'm going to delete this sync block and add an integrator block. The output of this will be x dot, which is velocity. And I'll add another integrator block. And the output of this will be our displacement. I can visualize the displacement in my scope. Okay. Now remember, the damping coefficient is multiplied with the velocity and the spring coefficient is multiplied with the displacement. So let's go ahead and add a gain block. This will be b. So b should be multiplied with the velocity. And k should be multiplied with displacement. And we can go ahead and add it to this subtraction block. So now you have basically used the mathematical equation and modeled it into the simulink environment. Now let's go ahead and save this model before we start running it.
So once you have saved the block, remember we had defined in the workspace the simulation time. So you can use the same variable here so that it will you can change the simulation time from the workspace. And once you do that, let's go and hit run. The model has completed the simulation and you can go and check your scope. So in the scope, you can see this is our displacement of the spring. So initially there was input. It started oscillating and eventually because of the damper and the spring mass spring attached, it died out and the displacement is near to zero now.
And this is a simple example of how you can model a dynamic system. So let's go back to our slides. So now that you have learned how to model a dynamic system and how to use that dynamic equation into a simulink environment, let's go and learn how we can use it to design a control system. So a control system is basically is a combination of different dynamic equations systems and a control system is used to get from a desired input to a desired output. And let's take a simple example and understand how that works. So here I have two different examples. So there in general, there are different types of control systems and broadly, they can be open loop control systems and closed loop control systems. So what's an open loop control system? Let's take an example of a toaster. So in this type of control system, there is an input given and the output is the depends on the control system and the output is always fixed. There is no way for us to control the type of output. For example, if this toaster runs for a certain time and a certain temperature, the output of this toasted bread will always be the same. And there's no way for us to control this. So this is a typical example of an open loop control system. Now let's go ahead and see how a closed loop control system works. A closed loop control system has an extra component, which is the feedback mechanism. What happens here is we take a measurement of the output at each time step in a simulation period and we feed it back to the controller. And let's see how that works. Let's say I have a much smarter toaster and this has comes with different settings where you can have an input of a bread and you can get three different levels of toasted breads. And for each levels of toasted bread, I know the amount of temperature the toaster needs to be operated. So let's say I want to have the maximum level of toasted bread. And I know that the controller already has all this information where it knows what temperature to operate at. Let's say it's x degrees. So what will happen now is at every time period, the temperature measurement will be taken. And until the x degrees Celsius is reached, the controller will keep increasing and adjusting the temperature. And let's say the toaster has a time period of five minutes. So it's going to maintain that temperature for five minutes until I reach the desired amount of selected toasted bread. So this is a simple example how a closed loop control system works. There is a feedback mechanism where we take a measurement of the output and feed it to the controller. And the controller adjusts its inputs such a way that we always get the desired So, let's see what it means in actual control system terms.
When you generally see any kind of feedback control system, you will often see it in this block diagram format. So, there are essentially four steps in designing a control system. So, let's go ahead and see the first step. So, first of all, this is an example I've taken for a normal cruise control system. A cruise control is a very common feature in modern vehicles where the driver can set a desired speed where he wants to travel. And there is a controller which can automatically control the vehicle speed and keep it at the desired level.
So, let's say the current speed of the vehicle is at 140 kph and the driver wants to go at 120 kph. So, he will set the speed, let's say 200 kph and the controller will adjust the amount of throttle and amount of powertrain input to maintain that particular speed. And let's see how the four steps of our control system work. So, the first step is the comparison block. And what is the comparison block? Here is where we calculate the error. The error is the reference input, that is our V reference.
And this is our output and the difference is given by the error. This error, the job of our controller is to minimize the error. That means we want this error to be going to zero. That means when my error is zero, which means both my reference velocity and my output velocity are the same. That means I have achieved the goal of this control mechanism. Then comes the computation block. The computation block is where the mathematics of the controller happens. In a vehicle, this system or this algorithm is usually in the ADAS ECU or any kind of ECU.
It could be powertrain or chassis. So, the ECU will have this controller logic, where it's going to adjust different types of control variables in order to make this error zero. And third is the correction mechanism. So, once a controller has performed all the calculations, it's going to give a certain input of the control variable to the actuator or the plant. The actuator of a plant is nothing but our vehicle or the vehicle dynamics. So, as we learned in the system modeling lecture, where we use dynamic equations to model a plant, we will do the same thing here.
And we will have a very robust equation which represents our plant. And once the input from the controller comes to the plant, the plant can then generate the different types of powertrain inputs, which would help us achieve that goal. And this is where the correction happens. Correction is basically, let's say you are currently, the vehicle velocity is less than the reference velocity. That means your error is not equal to zero. So, the actuator, based on the control input, the actuator will increase the throttle and try to match it such that the vehicle velocity, actual velocity matches the reference velocity.
And once this correction action happens, that is the output, which is the actual output speed experienced by the driver. And the last mechanism is the measurement block. So, at each time step, and the time step can be depending on the frequency of the controller. So, at each time step, a measurement is taken. And in this case, it will be the velocity of the wheels. So, a velocity measurement is taken by the sensors on board the vehicle. And it's been supplied to the comparison block. And again, this cycle keeps happening for the entire duration of the simulation time.
So, this was how a control system generally works. And even going forward, the more complex plant mechanisms get, this format of control system representation will still remain the same. We would always have a controller, a plant, and a measurement output. So, now that we have a basic knowledge of control systems, in the next section, we will learn how we can use mathematic, different linear algebra techniques to resolve and calculate control systems. So, let's go into the next section.