- 文章链接:Consensus Control of Leader-Following Multi-Agent Systems in Directed Topology With Heterogeneous Disturbances
- 仿真遇到的问题:论文里能用的公式数据等都用了,仿真结果差别还是很大,有仿真出来的大佬帮忙指点一下。
- 仿真代码
Fig3&4
% Consensus Control of Leader-Following Multi-Agent Systems in Directed Topology With Heterogeneous Disturbances
% author:JCGUY
% date:2022-05-11
clear
clc
%% System Description
% System matrices
% A = [0 1 1
% 1 2 1
% -2 -6 -3];
% B = [0 1
% -1 0
% 0 0];
A = [ 0 -1 5;
0 0 0;
0 -1 0];
B = [ 3 0;
0 2;
1 2];
L = [2 0 -2 0;
-6 6 0 0;
0 0 1.95 -1.95;
0 -2.1 0 2.1];
D=[1 0 0 0;
0 1 0 0;
0 0 0 0;
0 0 0 0];
P=[ 3.1790 1.2601 1.2263;
1.2601 3.8669 -0.9512;
1.2263 -0.9512 3.8621];
K=[ -10.7633 -2.8291 -7.5050;
-4.9728 -5.8314 -5.7498];
F=[ 140.5774 59.4488 109.3712;
59.4488 42.0090 54.7618;
109.3712 54.7618 89.3852 ];
Abar = [0 0 2 0;
6 0 0 0;
0 0 0 1.95;
0 2.1 0 0];
%% Initial States
% Real states
x0(:,1) = [0.5,1.0,1.5]';
x1(:,1) = [2.0,2.5,3.0]';
x2(:,1) = [3.5,2.5,1.0]';
x3(:,1) = [2.0,2.0,1.0]';
x4(:,1) = [1.2,2.0,1.5]';
%% Time Parameters
tBegin = 0;
tFinal = 20;
dT = 0.001;
times = (tFinal-tBegin)/dT;
t(:,1) = 0;
g=0.3;
%% Iteration
for ti = 1:times
% Record time
t(:,ti+1) = t(:,ti) + dT;
% Leader states
dx0 = A*x0(:,ti)+