Cruise Control System State Space Observer design

I was reading through a systems book with matlab examples and I found an exercise for a simple cruise control system summarized as follows:
The model of the car is simplified as an object of mass m, on which are applied a controllable (by the system) force u as well as a drag force f = -bv (b a dumping factor and v the speed). Assuming we have no direct knowledge of the state of the system (its speed), we're using a GPS sensor to create an observer that estimates this state.
While modelling the open loop system, with one state, and the closed loop system assuming full knowledge of the state was relatively easy. I am having a tough time designing the observer and applying the solution in MATLAB. I have:
Open Loop System: A = [-b/m], B = [1/m], C = 1, D = 0 (the only state being the speed).
Closed Loop System: K = place(A, B, pole), where the pole was chosen based on some constraints, kr = 1 / ( C * inv(A - B*K) * B) and
Acl = A - B*K, Bcl = B*kr, Ccl = C, Dcl = D,
For the observer my idea was:
Create a new model of the open loop system, using as states both the speed and the position and as output the position
Ao = [0 1; 0 -b/m] Bo = [0; 1/m], Co = [1 0], Do = 0
At each time step use this model to obtain y (the position) and then estimate the two states using:
dx/dt = Ao*x_est + Bo*u + L(y - Co*x_est);
I do not want to use Simulink. And my problem is solving this last differential equation taking into account the correct value of u(t) = -K*x_est + kr*r as well as the correct value of y. I am trying to use ode45 and I am sure this can be solved this way somehow (it is an exercise of the book).
Could someone explain me how this could be done. Or, If my whole method is completely wrong, point me to the right direction?
Thanks in advance!

Answers (0)

Asked:

on 6 Nov 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!