Need help programming a 2-sliding mode differentiator by Arie Levant in matlab mfile.

Asked by Nitish Mulye

Nitish Mulye (view profile)

on 1 Mar 2018
Latest activity Edited by Mostafa Salam

Mostafa Salam (view profile)

on 14 Sep 2018
I am working on a model free iPID control which uses the derivative of the system output. I need to apply the 2-sliding mode differentiator designed by Arie Levant http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.218.6376&rep=rep1&type=pdf. The main three equations for the differentiator algoritm is as follows: I have already made a small program using these equations. I am working with discrete data that updates the values of the parameters each Iterations. Miu and lambda are user defined, and all initial values are 0.
for k=1:200
y(k)=k; %Desired Trajectories (a linear lineas ás an input)
end
% code
for k=2:200
x(k) = x(k-1)+d_y(k-1); %Integration of X (internal variable) using Euler backward method (x-dot= u)
u_1(k) = (-miu)*sign(x(k)-y(k-1)); % Formula of u_1 dot in the algorithm
U_1(k) = U_1(k-1)+u_1(k); % Integration of u_1 dot to obtain u_1 using Euler forward method
d_y(k) = U_1(k) - lamda*sqrt(abs(x(k)-y(k-1)))*sign(x(k)-y(k-1)); % derivative of y (U in the algorithm)
dy(k)=y(k)-y(k-1); % Derivative of Y using differece formula
end
end
My main question is that how do i integrate the x-dot and u1-dot (x(k) and U_1(k) in the program). I am using the Euler backward and forward method that are used by the discrete integrator block in simulink. I am geting the following result when i give a linear line as an input. Can anyone please check my program and suggest how to smooth the curve Answer by Mostafa Salam

Mostafa Salam (view profile)

on 14 Sep 2018
Edited by Mostafa Salam

Mostafa Salam (view profile)

on 14 Sep 2018

you can directly use Arie Levant algorithm from the following link:
in this website, the authors built a Simulink block which include the mentioned algorithm
to use it under m-file, you can call this block