Commit 5975216b by Patrick Göttsch

### Gitlab Runner Update from atc-aux-files/master:Merge branch 'prepare-for-mpc' into 'master'

parent a06eaf23
 %% Stability of a Multi-Vehicle Formation % ------------------------------------------------------------------------- % script : exercise_MAS_stability % ------------------------------------------------------------------------- % Author : Marcus Bartels % Version : December, 6th 2013 % Copyright: MB, 2013 % ------------------------------------------------------------------------- % % 1. Compute the closed loop poles for a single subsystem % 2. Compute the closed loop eigenvalues of the global system % 3. Plot the Nyquist diagram of the forward chain of a subsystem % % ------------------------------------------------------------------------- %% Initialization close all % Define number of agents N = 5; % Define plant model m = 10; b = 0.5; c = 0; PA = [0, 1; -c/m, -b/m]; PB = [0; 1/m]; PC = [1 0]; PD = 0; P = ss(PA,PB,PC,PD); nx = size(PA,1); % number of states % Define controller K = 20*tf([1 0.05],[1 2.4]); [KA,KB,KC,KD] = ssdata(K); % Define the Laplacian L = [1, -1/2, -1/2, 0, 0; 0, 1, 0, -1, 0; -1/2, 0, 1, -1/2, 0; 0 -1/2, -1/2, 1, 0; 0 -1/2, 0, -1/2, 1]; la = sort(eig(L)); %% Closed loop poles at a single subsystem for all eigenvalues of L ClPoles = zeros(size(PA,1)+size(KA,1), N); for ii = 1:N Pp = ss(PA,PB,la(ii)*PC,la(ii)*PD); Cl = feedback(Pp*K,1); ClPoles(:,ii) = pole(Cl); end disp('Closed loop poles for single subsystem:'); ClPoles %% Closed loop poles of the global system KB = -KB; % include negative sign due to negative feedback KD = -KD; A_11 = kron(eye(N),PA) + kron(eye(N),PB*KD*PC)*kron(L,eye(nx)); A_12 = kron(eye(N),PB*KC); A_21 = kron(eye(N),KB*PC)*kron(L,eye(nx)); A_22 = kron(eye(N),KA); A_ = [A_11, A_12; A_21, A_22]; disp('Closed loop poles for the global closed loop system'); pA_ = eig(A_) %% Nyquist plot nyquist(P*K); \ No newline at end of file