need help for robotics sliding mode control execution in matlab

23 views (last 30 days)
i am doing research in the topic of Distrubance observer control of robotic manipuator in healthcare applications. for this i need a code / diagram and exection in the control methods of robotics in matlab / phyton. if anyone have an idea about this, its helpful for me.

Accepted Answer

Sam Chak
Sam Chak on 3 Feb 2026 at 10:00
I am not familiar with your robotic research. But here is a code snippet for a simple Disturbance Observer that you can apply to your robotic sliding mode control work.
%% Disturbance Observer-based Control for Double Integrator systems
function dx = simpleDOBC(t, x)
dx = zeros(3, 1);
% parameters
xd = 0.2; % desired position
m = 3; % mass
d = 0.5; % disturbance load
k1 = 1; % proportional gain
k2 = 1; % derivative gain
k3 = 1; % observer gain
% controller
u = - x(3) - m*k1*x(2) - x(1) + xd - k2*x(2) - k1*k2*x(1) + k1*k2*xd;
% most mechanical systems can be expressed as a Double Integrator system
dx(1) = x(2);
dx(2) = (u + d)/m;
% disturbance observer
dx(3) = k3*(x(2) + k1*x(1) - k1*xd);
end
x0 = [1; 0; 0]; % initial values
tspan = linspace(0, 25, 2501);
[t, x] = ode45(@simpleDOBC, tspan, x0);
plot(t, x(:, 1)), grid on
xlabel('Time, t')
title('System''s Position')
plot(t, x(:, 3)), grid on
yline(0.5, '--')
xlabel('Time, t')
title('Disturbance estimated by the Observer')

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!