
Prescribed time disturbance observer does not estimate in prescribed settling time.
148 views (last 30 days)
Show older comments
controlEE
on 9 Nov 2025 at 7:32
Commented: controlEE
about 3 hours ago
Hi, I hope you are feeling well. I have designed a prescribed time disturbance observer based on the idea that was used to design a prescribed time controller. First, I have apllied the controller to a first order and then to a third order system. The problem I have is that the disturbance observer does not work in a prescribed time, I change the settling time, but it still works in a fixed settling time that is around 1.5 seconds. I have attached the simulink model here. I really appreciate your help if you can tell me how I can solve the problem.
3 Comments
Sam Chak
on 19 Nov 2025 at 8:11
Hi @controlEE
I am still investigating the issue because it took considerable time to convert the unannotated, index‑style code into a mathematically interpretable form. Several parameters and equations in the code remain unclear to me. To facilitate the analysis, could you provide the equations that lead to the derivation of the rate of change of the disturbance error,
, where
?
That analysis should allow us to find out why the estimated disturbance
consistently converges between 1.0 s and 1.4 s as tau varies from 0 to 1, regardless of the observer’s prescribed‑time setting h.
Note that the effect of the prescribed‑time observer becomes insignificant for large values of tau, but becomes noticeable when tau is very small (approaching zero).
% Sam: related to simulation time
% ------------------------------
t0 = 0; % start time
tf = 10; % final time
dt = 0.001; % step size
t = t0:dt:tf; % time vector
% Sam: related to the control and estimation parameters
% ------------------------------
a = 0.01;
% tau = 6.65/7; % system is still stable in the range 0 < tau < 1
tau = 0;
h = 3; % prescribed settling time of the observer
delay = h/dt;
Tfc = 5; % prescribed settling time of the controller
eps1 = -2;
eps2 = 3;
% Sam: related to external disturbance
% ------------------------------
% d = 2*sin(0.2*pi*t) + 0.15*sin(2*pi*t); % time-varying disturbance
d = 1*ones(1, length(t)); % constant disturbance (easy to analyze)
% Sam: related to initial condition
% ------------------------------
D1 = 0.7*pi;
x10 = 1; % initial value of x1
x20 = -1; % initial value of x2
d_hat(1)= -2;
x1(1) = x10;
x2(1) = x20;
% Sam: related to delayed terms
% ------------------------------
mu(1) = 0.3;
mu0 = mu(1);
b1 = 2;
b2 = 3;
phi(1) = mu(1) + x2(1);
phi1(1) = - b1*(1 - exp(-x1(1)))/(Tfc - t(1));
Sd0 = 8;
% Sam: related to prescribed-time
% ------------------------------
W = @(s) exp(a*s).*(s - h).^5.*(2*h - s).^5;
Wc = 1/(integral(W, h, 2*h));
% Sam: Main code
% ------------------------------
for i = 1:length(t)-1
if t(i) < h
Rh(i) = 0;
elseif t(i) >= h && t(i) <= 2*h
% Rh(i) = sin(pi*t(i)/h)^2;
Rh(i) = (t(i) - h).^5*(2*h - t(i)).^5;
else
Rh(i) = 0;
end
if (i - delay) <= 0
mud(i) = mu0;
Sdd(i) = Sd0;
else
Sdd(i) = Sd(i-delay);
mud(i) = mu(i-delay);
end
z2(i) = x2(i) - phi1(i);
%% Predefined-time Backstepping controller
if t(i) < Tfc - 0.0001
dphi1_dt(i) = - b1*(1 - exp(-x1(i)))/(Tfc - t(i))^2 - b1*x2(i)*exp(- x1(i))/(Tfc - t(i));
phi1(i+1) = phi1(i) + dphi1_dt(i)*(t(i+1) - t(i));
dphi1_dx1(i)= - b1*exp(- x1(i))/(Tfc - t(i));
phi2(i) = - b2*1/(Tfc - t(i))*(1 - exp(- z2(i)));
else
dphi1_dt(i) = 0;
dphi1_dx1(i)= -1500;
phi1(i+1) = 0;
phi2(i) = 0;
end
% Controller
u(i) = - (x1(i) + eps1*x1(i) + eps2*x2(i)*(1 - x1(i)^2) + d_hat(i) - dphi1_dt(i) - dphi1_dx1(i)*x2(i) - phi2(i));
% the bell-shaped curve
K(i) = Rh(i)*Wc*exp(- a*(h - 2*t(i)));
% discretized differential equation for state x1
dx1(i) = x2(i);
x1(i+1) = x1(i) + dx1(i)*(t(i+1) - t(i));
% discretized differential equation for state x2
dx2(i) = eps1*x1(i) + eps2*(1 - x1(i)^2)*x2(i) + d(i) + u(i);
x2(i+1) = x2(i) + dx2(i)*(t(i+1) - t(i));
% discretized differential equation for state phi
dphi(i) = eps1*x1(i) + eps2*(1 - x1(i)^2)*x2(i) + u(i) + d_hat(i) - (a/(2*(1 - tau))*mu(i) + K(i)/(2*(1 - tau))*sign(mu(i))*(abs(mu(i)))^(2*tau - 1)*abs(mud(i))^(2*(1 - tau)));
phi(i+1)= phi(i) + dphi(i)*(t(i+1) - t(i));
mu(i+1) = phi(i+1) - x2(i+1);
%% Arbitrary Time Sliding Mode Disturbance Observer
dmu(i) = (mu(i+1) - mu(i))/dt;
% Sam: Most probably a sliding variable related to the disturbance error?
Sd(i) = dmu(i) + a/(2*(1 - tau))*mu(i) + K(i)/(2*(1 - tau))*sign(mu(i))*(abs(mu(i)))^(2*tau - 1)*abs(mud(i))^(2*(1 - tau));
% dd_hat(i) = -(D1*sign(Sd(i))+a/(1-tau)*Sd(i)+K(i)/(1-tau)*abs(Sd(i))^(2*tau-1)*sign(Sd(i))*abs(Sdd(i))^(2*(1-tau)));
dd_hat(i) = -(D1 + a/(2*(1 - tau))*abs(Sd(i)) + K(i)/(2*(1 - tau))*abs(Sd(i))^(2*tau - 1)*sign(Sd(i))*abs((Sdd(i)))^(2*(1 - tau)))*sign(Sd(i));
d_hat(i+1) = d_hat(i) + (t(i+1) - t(i))*dd_hat(i);
end
figure
set(gcf, 'color', 'white')
subplot(2,2,1)
plot(t, x1, 'r', 'LineWidth', 1.2); grid minor
leg1 = legend({'$x_1(t)$'});
set(leg1, 'Interpreter', 'latex');
title('Window 1'), xlabel('t(s)'), ylabel('x1'), ylim([-1 1])
subplot(2,2,2)
plot(t, x2, 'b', 'LineWidth', 1.2); grid minor
leg2 = legend({'$x_2(t)$'});
set(leg2, 'Interpreter', 'latex');
title('Window 2'), xlabel('t(s)'), ylabel('x2'), ylim([-1 1])
subplot(2,2,3)
plot(t, d, 'c', t, d_hat, 'm', 'LineWidth', 1.2); grid minor
leg3 = legend({'$d(t)$'; '$\hat{d}(t)$'});
set(leg3, 'Interpreter', 'latex');
title('Window 3'), xlabel('t(s)'), ylabel('d(t)')
subplot(2,2,4)
plot(t(1:end-1), Sd, 'LineWidth', 1.2); grid minor
leg4 = legend({'$S_d(t)$'});
set(leg4, 'Interpreter', 'latex');
title('Window 4'), xlabel('t(s)'), ylabel('Sd(t)')
leg = [leg1 leg2 leg3 leg4];
set(leg, 'FontSize', 12)
figure
plot(t(1:end-1), K), grid minor, ylim([-0.5, 1.5]),
title('Prescribed-time observer gain')
xlabel('t'), ylabel('K')
figure
plot(t, d_hat); grid minor
axis([1.0, 1.4, 0.9, 1.1])
title('Convergence of the Estimated disturbance')
xlabel('t'), ylabel({'$\hat{d}(t)$'}, 'Interpreter', 'latex')
figure
plot(t, d_hat); grid minor
axis([2.5, 5, 0.9, 1.1])
title('Anomaly in the Estimated disturbance (see Window 3)')
xlabel('t'), ylabel({'$\hat{d}(t)$'}, 'Interpreter', 'latex')
Accepted Answer
Sam Chak
on 20 Nov 2025 at 10:40
Hi @controlEE
I admit that I have difficulty understanding the mathematical notations and stability proof associated with the prescribed-time disturbance observer in the image (in this comment). I will use the basic disturbance observer in the following discussion to explain the underlying mathematical theory. You can follow and produce the mathematical derivations using your designed prescribed-time sliding mode disturbance observer. Hope it helps!
Section 1: van der Pol Oscillator
The dynamics of the Oscillator is given by:
where
is the disturbance and u is the control action.

With a simple linear PD Controller for the disturbance-free case, we can bring the states back to the origin:
where
.

Why it works? Because this nonlinear term
provides a good damping.
provides a good damping.Section 2: Design of a Disturbance Observer
To cancel out the effects of the disturbance, a feedback linearized PD controller is used. This approach allows the disturbance estimation problem to be formulated in a straightforward manner that can be easily followed.
Feedback linearized PD Controller
The closed-loop system becomes
which can be rewritten in matrix form:

as follows:
where
, The estimated disturbance is defined as the sum of the internal observer state z and the term
where
is the observer gain matrix to be designed:
Design of Disturbance Observer (to cancel out the terms in
)
Disturbance estimation error
If d is a constant disturbance, then
This tells us that the disturbance observer can estimate the disturbance such that the observer gain matrix
is designed to make 

Because the Oscillator is already Hurwitz stable, we just need to do this to cancel out the effects of the disturbance:
Section 3: MATLAB code for a Disturbance Observer-based PD control:
There are two design parameters in the code. The rule of thumb in the design is to ensure that the disturbance estimation error convergence time
is much faster than the desired settling time
of the control system. In this example, I let
.
%% van der Pol Oscillator
function dx = vanderPol(t, x)
% system parameters
eps1 =-2;
eps2 = 3;
% external disturbance
d = 1; % constant disturbance
% d = sin(pi/5*t); % time-varying disturbance
% settings related to the disturbance observer
Tc = 0.4; % desired convergence time (1st design parameter)
tau = 5/Tc; % observer gain (equivalent to time constant)
L = [0, tau]; % disturbance observer gain matrix
B = [0; 1]; % input matrices for B1 and B2
z = x(3); % internal state of disturbance observer
dhat = z + L*[x(1); x(2)]; % estimated disturbance definition
% settings related to the linear controller
Ts = 4; % desired settling time (2nd design parameter)
kp = (6/Ts)^2; % proportional gain
kd = 2*sqrt(kp); % derivative gain
% to cancel out the effect of disturbance
mu = - dhat; % for rejecting constant disturbance
% mu = - 0.05*sign(x(1) + x(2)) - dhat; % for rejecting time-varying disturbance
% feedback linearized PD controller to stabilize the Oscillator when d = 0
u = - eps1*x(1) - eps2*(1 - x(1)^2)*x(2) - kp*x(1) - kd*x(2) + mu;
% state matrix of linearized system (Hurwitz stability)
A = [ 0, 1;
-kp, -kd];
% van der Pol Oscillator differential equations
dx(1) = x(2);
dx(2) = eps1*x(1) + eps2*(1 - x(1)^2)*x(2) + d + u;
% disturbance observer differential equation
dx(3) = - L*B*dhat - L*(A*[x(1); x(2)] + B*mu);
% system dynamics
dx = [dx(1);
dx(2);
dx(3)];
end
[t, x] = ode45(@vanderPol, [0, 12], [1, -1, 0]);
%% plot results
plot(t, x(:,1:2)), grid on
title('States of controlled van der Pol Oscillator')
legend({'$x_{1}$', '$x_{2}$'}, 'Interpreter', 'latex', 'fontsize', 12)
xlabel({'$t$'}, 'Interpreter', 'latex')
ylabel({'$\mathbf{x}(t)$'}, 'Interpreter', 'latex')
plot(t, [ones(length(t), 1), x(:,3)]), grid on % Case 1
% plot(t, [sin(pi/5*t), x(:,3)]), grid on % Case 2
title('Time response of the estimated disturbance')
legend({'$d$', '$\hat{d}$'}, 'Interpreter', 'latex', 'fontsize', 12)
xlabel({'$t$'}, 'Interpreter', 'latex')
ylabel({'$\hat{d}$'}, 'Interpreter', 'latex')
6 Comments
More Answers (0)
See Also
Categories
Find more on Visualization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




