【Paper】2003_Consensus Problems in Networks of Agents with Switching Topology and Time-Delays
此篇文章主要在于仿真代碼,關于文獻的解釋請參考 【Paper】2003_Murr_Consensus Problems in Networks of Agents with Switching Topology and Time-Delays
文獻原文: Consensus Problems in Networks of Agents with Switching Topology and Time-Delays
Consensus Problems in Networks of Agents with Switching Topology and Time-Delays
- 原Paper中Figure5復現
- 原Paper中Figure6復現
- 原Paper中Figure6復現
三種網絡:
第一個問題:另一篇文章中,有提到若全連接,則系統的穩定性會被破壞。
第二個問題:第二個問題:平均一致性與系統的一致性不是一碼事,平均一致性是 average-consensus,系統一致性是 general agreement。
% 此為論文中,關于Fig5(a)中a子圖的復現結果。 % 輸入參數包括初始狀態(位置)和圖的拉普拉斯矩陣 % 最后顯示狀態一致性收斂的蹤跡和輸入的變化曲線 clc; clear;%% 輸入初始化參數 X0 = [-10.2999, 0.2575, -4.4997, 3.6258, 3.0922, 9.0156, 3.5099, -2.6645, 2.4552, -4.4921]'; % 一致性決策值 AveVal = mean(X0); % 平均一致性 MaxVal = max(X0); % 最大一致性 MinVal = min(X0); % 最小一致性 n = 10; % 節點數量 % 度矩陣,有向拓撲結構 D =[1 0 0 0 0 0 0 0 0 0;0 1 0 0 0 0 0 0 0 0;0 0 1 0 0 0 0 0 0 0;0 0 0 1 0 0 0 0 0 0;0 0 0 0 1 0 0 0 0 0;0 0 0 0 0 1 0 0 0 0;0 0 0 0 0 0 1 0 0 0;0 0 0 0 0 0 0 1 0 0;0 0 0 0 0 0 0 0 1 0;0 0 0 0 0 0 0 0 0 1;]; % 鄰接矩陣,有向拓撲結構 A =[0 1 0 0 0 0 0 0 0 0;0 0 1 0 0 0 0 0 0 0;0 0 0 1 0 0 0 0 0 0;0 0 0 0 1 0 0 0 0 0;0 0 0 0 0 1 0 0 0 0;0 0 0 0 0 0 1 0 0 0;0 0 0 0 0 0 0 1 0 0;0 0 0 0 0 0 0 0 1 0;0 0 0 0 0 0 0 0 0 1;1 0 0 0 0 0 0 0 0 0;]; %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 0 0 0 0;0 0 0 0 0 0 2 0 0 0;0 0 0 0 0 0 0 3 0 0;0 0 0 0 0 0 0 0 2 0;0 0 0 0 0 0 0 0 0 1;]; % 鄰接矩陣,有向拓撲結構 A =[0 1 0 0 0 0 0 0 1 0;0 0 1 0 0 0 0 1 0 0;0 0 0 1 0 0 0 0 0 0;0 0 0 0 1 0 0 1 0 0;0 0 0 0 0 1 1 0 0 0;0 0 0 0 0 0 1 0 0 0;0 0 0 0 1 0 0 1 0 0;0 1 0 1 0 0 0 0 1 0;1 0 0 0 0 0 0 0 0 1;1 0 0 0 0 0 0 0 0 0;]; % 拉普拉斯矩陣 L = D - A;% 矩陣的代數連通度 eig_val = eig(L); % L的特征值 eig_val = sort(eig_val,'ascend'); % 從小到大排序,最小特征值為0 algeb_conn = eig_val(2); % algebraic connectivity 代數連通度:lap_matrix的第二小特征值>0,連通圖%% 收斂相關參數 tBegin = 0; % 開始時間 tEnd = 15; % 結束時間 h = 0.1; % 最小時間間隔 times = (tEnd-tBegin) / h; % 迭代計算次數 X(:,1) = X0; % X的第一列等于X1 U(:,1) = -L * X0; t(1) = tBegin; % 時間間隔記錄表i = 1; while(i <= times)t(i+1) = tBegin + i * h; % 添加更新后的t值Xt = X(:,i);Ut = -L * Xt; % u = -Lx % Xt1 = Xt + h * Ut; % x = x + h*uXt1 = expm(-L*(tBegin+i*h)) * X0; % x = x + h*uX(:,i+1) = Xt1; % 添加更新后的Xt值U(:,i+1) = Ut; % 添加更新后的Ut值 i = i+1; end%% 結果顯示 % 繪制圖像 subplot(2,1,1) plot(t,X(1,:), t,X(2,:), t,X(3,:), t,X(4,:), t,X(5,:), t,X(6,:), t,X(7,:), t,X(8,:), t,X(9,:), t,X(10,:), 'linewidth',2.0) % legend("x_1","x_2","x_3","x_4","x_5","x_6","x_7","x_8","x_9","x_{10}"); xlabel('Times/收斂次數'); ylabel('States/狀態值'); title('States-Times');subplot(2,1,2) plot(t,U(1,:), t,U(2,:), t,U(3,:), t,U(4,:), t,U(5,:), t,U(6,:), t,U(7,:), t,U(8,:), t,U(9,:), t,U(10,:), 'linewidth',2.0) % legend("u_1","u_2","u_3","u_4","u_5","u_6","u_7","u_8","u_9","u_{10}"); xlabel('Times/收斂次數'); ylabel('U/輸入值'); title('U-Times');
原Paper中Figure5復現
clear; clc; % 此為原Paper中Figure5復現代碼% 狀態初值如下 X0 = [-10.2999, 0.2575, -4.4997, 3.6258, 3.0922, 9.0156, 3.5099, -2.6645, 2.4552, -4.4921]';Node_Nums = 10;% a圖度矩陣,鄰接矩陣,拉普拉斯矩陣 D_a = [ 1 0 0 0 0 0 0 0 0 0;0 1 0 0 0 0 0 0 0 0;0 0 1 0 0 0 0 0 0 0;0 0 0 1 0 0 0 0 0 0;0 0 0 0 1 0 0 0 0 0;0 0 0 0 0 1 0 0 0 0;0 0 0 0 0 0 1 0 0 0;0 0 0 0 0 0 0 1 0 0;0 0 0 0 0 0 0 0 1 0;0 0 0 0 0 0 0 0 0 1;]; A_a = [ 0 1 0 0 0 0 0 0 0 0;0 0 1 0 0 0 0 0 0 0;0 0 0 1 0 0 0 0 0 0;0 0 0 0 1 0 0 0 0 0;0 0 0 0 0 1 0 0 0 0;0 0 0 0 0 0 1 0 0 0;0 0 0 0 0 0 0 1 0 0;0 0 0 0 0 0 0 0 1 0;0 0 0 0 0 0 0 0 0 1;1 0 0 0 0 0 0 0 0 0;]; L_a = D_a - A_a;% b圖度矩陣,鄰接矩陣,拉普拉斯矩陣 D_b = [ 1 0 0 0 0 0 0 0 0 0;0 2 0 0 0 0 0 0 0 0;0 0 2 0 0 0 0 0 0 0;0 0 0 2 0 0 0 0 0 0;0 0 0 0 1 0 0 0 0 0;0 0 0 0 0 2 0 0 0 0;0 0 0 0 0 0 1 0 0 0;0 0 0 0 0 0 0 1 0 0;0 0 0 0 0 0 0 0 1 0;0 0 0 0 0 0 0 0 0 2;]; A_b = [ 0 1 0 0 0 0 0 0 0 0;0 0 1 0 0 0 0 0 0 1;0 0 0 1 0 0 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1 0 0;0 1 0 1 0 0 0 0 1 0;1 0 0 0 0 0 0 0 0 1;1 0 0 0 0 0 0 0 0 0;]; L_d = D_d - A_d;% 設置收斂相關參數 tBegin = 0; % 開始時間 tEnd = 20; % 結束時間 dt = 0.1; % 最小時間間隔 times = (tEnd-tBegin) / dt; % 迭代計算次數 time = 1; % 定義記錄時間數組 t(:,1) = tBegin; % 定義圖a數據存儲數組 X_a(:,1) = X0; U_a(:,1) = -L_a * X0; Delta_a(:,1) = X0' * L_a * X0; % 定義圖b數據存儲數組 X_b(:,1) = X0; U_b(:,1) = -L_b * X0; Delta_b(:,1) = X0' * L_b * X0;X_c(:,1) = X0; U_c(:,1) = -L_c * X0; Delta_c(:,1) = X0' * L_c * X0;X_d(:,1) = X0; U_d(:,1) = -L_d * X0; Delta_d(:,1) = X0' * L_d * X0; % 開始收斂計算 while(time <= times)t(:,time+1) = tBegin + time * dt;% 圖a數據迭代X_a(:,time+1) = expm(-L_a * t(:,time+1)) * X0; % Xt = expm(-Lx)*X0 添加更新后的Xt值U_a(:,time+1) = -L_a * X_a(:,time+1); % Ut = -LXt 添加更新后的Ut值 Delta_a(:,time+1) = X_a(:,time+1)'*L_a*X_a(:,time+1); % Delta = X^T * L * X% 圖b數據迭代X_b(:,time+1) = expm(-L_b * t(:,time+1)) * X0;U_b(:,time+1) = -L_b * X_b(:,time+1);Delta_b(:,time+1) = X_b(:,time+1)'*L_b*X_b(:,time+1);X_c(:,time+1) = expm(-L_c * t(:,time+1)) * X0;U_c(:,time+1) = -L_c * X_c(:,time+1);Delta_c(:,time+1) = X_c(:,time+1)'*L_c*X_c(:,time+1);X_d(:,time+1) = expm(-L_d * t(:,time+1)) * X0;U_d(:,time+1) = -L_d * X_d(:,time+1);Delta_d(:,time+1) = X_d(:,time+1)'*L_d*X_d(:,time+1);time = time + 1; end% 矩陣的代數連通度 eig_val_a = eig(L_a); % L_a的特征值 eig_val_a = sort(eig_val_a,'ascend'); % 從小到大排序,最小特征值為0 AC_a = real(eig_val_a(2)); % algebraic connectivity 代數連通度:lap_matrix的第二小特征值>0,連通圖eig_val_b = eig(L_b); % L_b的特征值 eig_val_b = sort(eig_val_b,'ascend'); % 從小到大排序,最小特征值為0 AC_b = real(eig_val_b(2)); % algebraic connectivity 代數連通度:lap_matrix的第二小特征值>0,連通圖eig_val_c = eig(L_c); eig_val_c = sort(eig_val_c,'ascend'); AC_c = real(eig_val_c(2));eig_val_d = eig(L_d); eig_val_d = sort(eig_val_d,'ascend'); AC_d = real(eig_val_d(2));% 繪制圖a數據 subplot(4,2,1); plot(t,X_a(1,:), t,X_a(2,:), t,X_a(3,:), t,X_a(4,:), t,X_a(5,:), t,X_a(6,:), t,X_a(7,:), t,X_a(8,:), t,X_a(9,:), t,X_a(10,:), 'linewidth',1.5) xlabel("time(sec)");ylabel("node value"); title("Algebraic Connectivity="+num2str(AC_a)); subplot(4,2,3); plot(t,Delta_a, 'linewidth',1.5); xlabel("time(sec)");ylabel("disagreement");subplot(4,2,2); plot(t,X_b(1,:), t,X_b(2,:), t,X_b(3,:), t,X_b(4,:), t,X_b(5,:), t,X_b(6,:), t,X_b(7,:), t,X_b(8,:), t,X_b(9,:), t,X_b(10,:), 'linewidth',1.5) xlabel("time(sec)");ylabel("node value"); title("Algebraic Connectivity="+num2str(AC_b)); subplot(4,2,4); plot(t,Delta_b, 'linewidth',1.5); xlabel("time(sec)");ylabel("disagreement");subplot(4,2,5); plot(t,X_c(1,:), t,X_c(2,:), t,X_c(3,:), t,X_c(4,:), t,X_c(5,:), t,X_c(6,:), t,X_c(7,:), t,X_c(8,:), t,X_c(9,:), t,X_c(10,:), 'linewidth',1.5) xlabel("time(sec)");ylabel("node value"); title("Algebraic Connectivity="+num2str(AC_c)); subplot(4,2,7); plot(t,Delta_c, 'linewidth',1.5); xlabel("time(sec)");ylabel("disagreement");subplot(4,2,6); plot(t,X_d(1,:), t,X_d(2,:), t,X_d(3,:), t,X_d(4,:), t,X_d(5,:), t,X_d(6,:), t,X_d(7,:), t,X_d(8,:), t,X_d(9,:), t,X_d(10,:), 'linewidth',1.5) xlabel("time(sec)");ylabel("node value"); title("Algebraic Connectivity="+num2str(AC_d)); subplot(4,2,8); plot(t,Delta_d, 'linewidth',1.5); xlabel("time(sec)");ylabel("disagreement");figure(2) plot(t,X_a(1,:), t,X_a(2,:), t,X_a(3,:), t,X_a(4,:), t,X_a(5,:), t,X_a(6,:), t,X_a(7,:), t,X_a(8,:), t,X_a(9,:), t,X_a(10,:), 'linewidth',1.5)原Paper中Figure6復現
clear; clc; % 此為原Paper中Figure6復現代碼% 狀態初值如下 X0 = [-10.2999, 0.2575, -4.4997, 3.6258, 3.0922, 9.0156, 3.5099, -2.6645, 2.4552, -4.4921]';Node_Nums = 10;% b圖度矩陣,鄰接矩陣,拉普拉斯矩陣 D_a = [ 1 0 0 0 0 0 0 0 0 0;0 1 0 0 0 0 0 0 0 0;0 0 1 0 0 0 0 0 0 0;0 0 0 1 0 0 0 0 0 0;0 0 0 0 1 0 0 0 0 0;0 0 0 0 0 1 0 0 0 0;0 0 0 0 0 0 1 0 0 0;0 0 0 0 0 0 0 1 0 0;0 0 0 0 0 0 0 0 1 0;0 0 0 0 0 0 0 0 0 1;]; A_a = [ 0 1 0 0 0 0 0 0 0 0;0 0 1 0 0 0 0 0 0 0;0 0 0 1 0 0 0 0 0 0;0 0 0 0 1 0 0 0 0 0;0 0 0 0 0 1 0 0 0 0;0 0 0 0 0 0 1 0 0 0;0 0 0 0 0 0 0 1 0 0;0 0 0 0 0 0 0 0 1 0;0 0 0 0 0 0 0 0 0 1;1 0 0 0 0 0 0 0 0 0;]; L_a = D_a - A_a;% b圖度矩陣,鄰接矩陣,拉普拉斯矩陣 D_b = [ 1 0 0 0 0 0 0 0 0 0;0 2 0 0 0 0 0 0 0 0;0 0 2 0 0 0 0 0 0 0;0 0 0 2 0 0 0 0 0 0;0 0 0 0 1 0 0 0 0 0;0 0 0 0 0 2 0 0 0 0;0 0 0 0 0 0 1 0 0 0;0 0 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 0;0 0 1 0 0 0 0 1 0 0;0 0 0 1 0 0 0 0 0 0;0 0 0 0 1 0 0 1 0 0;0 0 0 0 0 1 1 0 0 0;0 0 0 0 0 0 1 0 0 0;0 0 0 0 1 0 0 1 0 0;0 1 0 1 0 0 0 0 1 0;1 0 0 0 0 0 0 0 0 1;1 0 0 0 0 0 0 0 0 0;]; L_d = D_d - A_d;% 設置收斂相關參數 tBegin = 0; % 開始時間 tEnd = 15; % 結束時間 dt = 0.1; % 最小時間間隔 times = (tEnd-tBegin) / dt; % 迭代計算次數 time = 1; % 定義記錄時間數組 t(:,1) = tBegin; % 定義圖數據存儲數組 % t=0時刻,狀態為b X(:,1) = X0; U(:,1) = -L_b * X0; Delta(:,1) = X0' * L_b * X0;% 開始收斂計算 while(time <= times)% 迭代順序為 b->a->d->c->bif ((time>=1 && time<=10)||(time>=41 && time<=50)||(time>=81 && time<=90)||(time>=121 && time<=130))L = L_b;elseif((time>=11 && time<=20)||(time>=51 && time<=60)||(time>=91 && time<=100)||(time>=131 && time<=140))L = L_a;elseif((time>=21 && time<=30)||(time>=61 && time<=70)||(time>=101 && time<=110)||(time>=141 && time<=150))L = L_d;elseif((time>=31 && time<=40)||(time>=71 && time<=80)||(time>=111 && time<=120))L = L_c;endt(:,time+1) = tBegin + time * dt;X(:,time+1) = expm(-L * t(:,time+1)) * X0;U(:,time+1) = -L * X(:,time+1);Delta(:,time+1) = X(:,time+1)'*L*X(:,time+1);time = time + 1; end% 繪制圖數據 subplot(2,1,1); plot(t,X(1,:), t,X(2,:), t,X(3,:), t,X(4,:), t,X(5,:), t,X(6,:), t,X(7,:), t,X(8,:), t,X(9,:), t,X(10,:), 'linewidth',1.5) xlabel("time(sec)");ylabel("node value"); subplot(2,1,2); plot(t,Delta, 'linewidth',1.5); xlabel("time(sec)");ylabel("disagreement");原Paper中Figure6復現
clear; clc; % 此為原Paper中Figure6復現代碼% 狀態初值如下 X0 = [-10.2999, 0.2575, -4.4997, 3.6258, 3.0922, 9.0156, 3.5099, -2.6645, 2.4552, -4.4921]';Node_Nums = 10;D = [ 2 0 0 0 0 0 0 0 0 0;0 3 0 0 0 0 0 0 0 0;0 0 4 0 0 0 0 0 0 0;0 0 0 4 0 0 0 0 0 0;0 0 0 0 4 0 0 0 0 0;0 0 0 0 0 4 0 0 0 0;0 0 0 0 0 0 4 0 0 0;0 0 0 0 0 0 0 4 0 0;0 0 0 0 0 0 0 0 3 0;0 0 0 0 0 0 0 0 0 2;]; A = [ 0 1 1 0 0 0 0 0 0 0;1 0 1 1 0 0 0 0 0 0;1 1 0 1 1 0 0 0 0 0;0 1 1 0 1 1 0 0 0 0;0 0 1 1 0 1 1 0 0 0;0 0 0 1 1 0 1 1 0 0;0 0 0 0 1 1 0 1 1 0;0 0 0 0 0 1 1 0 1 1;0 0 0 0 0 0 1 1 0 1;0 0 0 0 0 0 0 1 1 0;]; L = D - A;% 設置收斂相關參數 tBegin = 0; % 開始時間 tEnd = 15; % 結束時間 dt = 0.01; % 最小時間間隔 times = (tEnd-tBegin) / dt; % 迭代計算次數 time = 1; % 定義記錄時間數組 t(:,1) = tBegin; % 定義圖數據存儲數組 X1(:,1) = X0; U1(:,1) = -L * X0; Delta(:,1) = X0' * L * X0;X2(:,1) = X0; U2(:,1) = -L * X0;X3(:,1) = X0; U3(:,1) = -L * X0;X4(:,1) = X0; U4(:,1) = -L * X0;X5(:,1) = X0; U5(:,1) = -L * X0;X6(:,1) = X0; U6(:,1) = -L * X0;% 開始收斂計算 while(time <= times)t(:,time+1) = tBegin + time * dt;U1(:,time) = -L*X1(:,time);X1(:,time+1) = U1(:,time)*dt + X1(:,time); % X(:,time+1) = expm(-L * t(:,time+1)) * X0;if time<=13 % U2(:,time) = -L*X2(:,time); % X2(:,time+1) = U2(:,time)*dt + X2(:,time);X2(:,time+1) = -L*X2(:,time) * dt + X2(:,time); % X2(:,time+1) = expm(-L * t(:,time+1)) * X0;else % U2(:,time) = -L*X2(:,time-13); % X2(:,time+1) = U2(:,time)*dt + X2(:,time-13);X2(:,time+1) = -L*X2(:,time-13) * dt + X2(:,time); % X2(:,time+1) = expm(-L * t(:,time+1-13)) * X0;endif time<=18 % U3(:,time) = -L*X3(:,time); % X3(:,time+1) = U3(:,time)*dt + X3(:,time);X3(:,time+1) = -L*X3(:,time) * dt + X3(:,time); % X3(:,time+1) = expm(-L * t(:,time+1)) * X0;else % U3(:,time) = -L*X3(:,time-18); % X3(:,time+1) = U3(:,time)*dt + X3(:,time-18);X3(:,time+1) = -L*X3(:,time-13) * dt + X3(:,time); % X3(:,time+1) = expm(-L * t(:,time+1-18)) * X0;endif time<=26 % U4(:,time) = -L*X4(:,time); % X4(:,time+1) = U4(:,time)*dt + X4(:,time);X4(:,time+1) = -L*X4(:,time) * dt + X4(:,time); % X4(:,time+1) = expm(-L * t(:,time+1)) * X0;else % U4(:,time) = -L*X4(:,time-26); % X4(:,time+1) = U4(:,time)*dt + X4(:,time-26);X4(:,time+1) = -L*X4(:,time-26) * dt + X4(:,time); % X4(:,time+1) = expm(-L * t(:,time+1-26)) * X0;endif time<=25X5(:,time+1) = -L*X5(:,time) * dt + X5(:,time);elseX5(:,time+1) = -L*X5(:,time-25) * dt + X5(:,time);endif time<=28X6(:,time+1) = -L*X6(:,time) * dt + X6(:,time);elseX6(:,time+1) = -L*X6(:,time-28) * dt + X6(:,time);endtime = time + 1; end% 繪制圖數據 subplot(3,2,1); plot(t,X1(1,:), t,X1(2,:), t,X1(3,:), t,X1(4,:), t,X1(5,:), t,X1(6,:), t,X1(7,:), t,X1(8,:), t,X1(9,:), t,X1(10,:), 'linewidth',1.5) xlabel("time(sec)");ylabel("state"); title("Time-Delay=0(sec)");subplot(3,2,2); plot(t,X2(1,:), t,X2(2,:), t,X2(3,:), t,X2(4,:), t,X2(5,:), t,X2(6,:), t,X2(7,:), t,X2(8,:), t,X2(9,:), t,X2(10,:), 'linewidth',1.5) xlabel("time(sec)");ylabel("state"); title("Time-Delay=0.13(sec)");subplot(3,2,3); plot(t,X3(1,:), t,X3(2,:), t,X3(3,:), t,X3(4,:), t,X3(5,:), t,X3(6,:), t,X3(7,:), t,X3(8,:), t,X3(9,:), t,X3(10,:), 'linewidth',1.5) xlabel("time(sec)");ylabel("state"); title("Time-Delay=0.18(sec)");subplot(3,2,4); plot(t,X4(1,:), t,X4(2,:), t,X4(3,:), t,X4(4,:), t,X4(5,:), t,X4(6,:), t,X4(7,:), t,X4(8,:), t,X4(9,:), t,X4(10,:), 'linewidth',1.5) xlabel("time(sec)");ylabel("state"); title("Time-Delay=0.26(sec)");subplot(3,2,5); plot(t,X5(1,:), t,X5(2,:), t,X5(3,:), t,X5(4,:), t,X5(5,:), t,X5(6,:), t,X5(7,:), t,X5(8,:), t,X5(9,:), t,X5(10,:), 'linewidth',1.5) xlabel("time(sec)");ylabel("state"); title("Time-Delay=0.25(sec)");subplot(3,2,6); plot(t,X6(1,:), t,X6(2,:), t,X6(3,:), t,X6(4,:), t,X6(5,:), t,X6(6,:), t,X6(7,:), t,X6(8,:), t,X6(9,:), t,X6(10,:), 'linewidth',1.5) xlabel("time(sec)");ylabel("state"); title("Time-Delay=0.28(sec)");參考文獻:
[1] N. Biggs. Algebraic Graph Theory. Cambridge Tracks in Mathematics. Cambridge University Press, 1974.
[2] I. Daubechies and J. C. Lagarias. Sets of matrices all in?nite products of which converge. Linear Algebra and Its Applications, 161:227–263, 1992.
[3] I. Daubechies and J. C. Lagarias. Corrigendum/addendum to: Sets of matrices all in?nite products of which converge. Linear Algebra and Its Applications, 327:69–83, 2001.
[4] J. P. Desai, J. P. Ostrowski, and V. Kumar. Modeling and control of formations of nonholonomic mobile robots. IEEE Trans. on Robotics and Automation, 17(6), December 2002.
[5] R. Diestel. Graph Theory, volume 173 of Graduate Texts in Mathematics. SpringerVerlag, 2000.
[6] A. Fax and R. M. Murray. Graph Laplacians and stabilization of vehicle formations. The 15th IFAC World Congress, June 2002.
[7] A. Fax and R. M. Murray. Information Flow and Cooperative Control of Vehicle Formations. The 15th IFAC World Congress, June 2002.
[8] M. Fiedler. Algebraic connectivity of graphs. Czechoslovak Mathematical Journal, 23(98):298–305, 1973.
[9] M. Fiedler. A property of eigenvectors of nonnegative symmetric matrices and its application to graph theory. Czechoslovak Mathematical Journal, 25(100):619–633, 1975.
[10] F. R. Gantmacher. Matrix Theory, volume II. Chelsea Publishing Company, 1959.
[11] C. Godsil and G. Royle. Algebraic Graph Theory, volume 207 of Graduate Texts in Mathematics. Springer, 2001.
[12] R. A. Horn and C. R. Johnson. Matrix Analysis. Cambridge University Press, 1987.
[13] A. Jadbabaie, J. Lin, and S. A. Morse. Coordination of groups of mobile agents using nearest neighbor rules. IEEE Trans. on Automatic Control (to appear).
[14] R. W. Lawton, J. R. T. Beard and B. J. Young. A Decentralized Approach to Formation Maneuvers. IEEE Trans. on Robotics and Automation (to appear).
[15] N. A. Lynch. Distributed Algorithms. Morgan Kaufmann Publishers, Inc., 1997.
[16] M. Marcus and H. Minc. A Survey of Matrix Theory and Matrix Inequalities. Dover Publications, 1969.
[17] R. Merris. Laplacian matrices of a graph: a survey. Linear Algebra and its Applications, 197:143–176, 1994.
[18] M. Mesbahi. On a dynamic extension of the theory of graphs. Proc. of the American Control Conference, Anchorange, AL, May 2002.
[19] M. Mesbahi and F. Y. Hadegh. Formation ?ying of multiple spacecraft via graphs, matrix inequalities, and switching. AIAA Journal of Guidance, Control, and Dynamics, 24(2):369–377, March 2000.
[20] R. Olfati Saber and R. M. Murray. Consensus Protocols for Networks of Dynamic Agents. Proc. of the American Control Conference, June 2003.
[21] F. Paganini, J. Doyle, and S Low. Scalable laws for stable network congestion control. Proc. of the Int. Conf. on Decision and Control, Orlando, FL, Dec. 2001.
[22] C. W. Reynolds. Flocks, herds, and schools: a distributed behavioral model. Computer Graphics (ACM SIGGRAPH ’87 Conference Proceedings), 21(4):25–34, July 1987.
[23] J. Toner and Y. Tu. Flocks, herds, and schools: A quantitative theory of ?ocking. Physical Review E, 58(4):4828–4858, October 1998.
[24] T. Vicsek, A. Cziro′ok, E. Ben-Jacob, and O. Cohen, I. Shochet. Novel type of phase transition in a system of self-deriven particles. Physical Review Letters, 75(6):1226–1229, August, 1995.
總結
以上是生活随笔為你收集整理的【Paper】2003_Consensus Problems in Networks of Agents with Switching Topology and Time-Delays的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【Paper】2004_Informat
- 下一篇: 【数理知识】《矩阵论》方保镕老师-第5章