Model and control state space with perturbation
12 views (last 30 days)
Show older comments
Hi everybody,
I have a dynamic model with a perturbation such that:
I would like to know if it is possible to control both x and d ?
I would like the state x to follow a prescribed trajectory and reject the perturbation such that .
My problem is that I do not know the dynamics of d and I cannot include it into the state.
I have read the Matlab tutorials but I have not been able to model this problem correctly to solve it yet.
Thanks very much for your help
2 Comments
Sam Chak
on 15 Oct 2024
Hi @CN.
Which MATLAB tutorial are you reading? Since your first-order system is linear, I believe this control problem is typically addressed in all undergraduate-level control textbooks, such as those covering the PI controller.
Conventional textbooks usually provide more technical details and explanations but often lack coding examples. Typically, the reader is expected to code the equations and formulas based on their own interpretation.
Answers (1)
Sam Chak
on 15 Oct 2024
Hi @CN.
Regarding your inquiry, based on the given generic control problem, the state is controllable, and you can somewhat manage the effect of the disturbance on the time response of the state with a properly designed controller. However, it is not possible to make a non-zero disturbance become zero.
For example, when flying a drone, you can control the maneuverability of the drone. However, gusts of wind that change direction quickly and abruptly can make the drone difficult to operate. As you may know, you cannot make the speed of the wind gusts become zero because your controller does not directly affect wind speed.
I went to the library to refresh my knowledge of the PI control of 1st-order systems. Here is a simple demo, assuming that the disturbance is time-varying but changes slowly. The extended state can be used to estimate the disturbance and then to compensate for the disturbance.
%% Solving the ODE
tspan = [0 20]; % simulation time interval
initx = [1; 0]; % initial values of states
[t, x] = ode45(@system, tspan, initx);
%% Plot the results
x1 = x(:,1); % state 1 is the output of the system
x2 = x(:,2); % state 2 is the estimated disturbance
plot(t, [x1, x2]), grid on, grid minor
legend('state 1', 'state 2')
xlabel('t')
ylabel('\bf{x}')
%% The function for describing ODE
function dxdt = system(t, x)
% initialization
dxdt = zeros(2, 1);
% System parameters
A = 1; % state coefficient
B = 1; % control input coefficient
W = 1; % disturbance input coefficient
d = cos(pi/1000*t); % constant or slow time-varying disturbance
% Controller
Kp = 2; % Proportional gain
Ki = 1; % Integral gain
u = - Kp*x(1) - Ki*x(2);
% System dynamics
dxdt(1) = A*x(1) + B*u + W*d;
dxdt(2) = x(1); % extended state for estimating the disturbance
end
4 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!