多智能体有限时间一致性算法,自己用matlab编写的,能够正常运行,可自行修改使用。
主程序部分代码:
In = [Xl Xf]';
out = ode23(@ctFun, tspan, In);
t = out.x;
X = out.y;
plot(t,X(1,:), t,X(2,:), t,X(3,:), t,X(4,:), 'linewidth',1.5);
%% ODE Function
function out = ctFun(~,In)
global L B
a = 0.5;
Xl = In(1);
Xf = In(2:4);
v_0 = 0;
dXl = v_0;
delta = -(L+B)*(Xf-Xl);
delta = sig(delta,a);
dX = delta+ v_0;
out = [dXl
dX];
end
有限时间代码:
function sig = sig(x,a)
sig = sign(x).*abs(x).^a;
end
1