Commit 5494e58c by Patrick Göttsch

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

parent 2c5b3461
 %% Hidden Coupling - Instability of the linearized closed loop % ------------------------------------------------------------------------- % script : exercise_Hidden_Coupling % ------------------------------------------------------------------------- % Author : Christian Hoffmann % Version : May, 28th 2021 % Copyright: CH, 2013 % Update : PG, 2021 % ------------------------------------------------------------------------- % % 1. Construct linearized closed loop % 2. Plot eigenvalues for different parameter values % % ------------------------------------------------------------------------- %% 1. rho = -0.9:0.01:0.9; xKe = atanh(rho); urho = ureal('urho', 0 , 'Range', [-1, 1]); uxKe = ureal('uxKe', atanh(0), 'Range', [min(xKe), max(xKe)]); uAcl = [ -1 + (-1/3+2*urho*uxKe)/(1-urho^2) , 1/(1-urho^2) ;... -(1-urho^2) , 0 ]; for ii = 1:length(rho) Aclsubs = usubs(uAcl , 'uxKe', xKe(ii)); Aclsubs = usubs( Aclsubs, 'urho', rho(ii)); eigVals(:, ii) = eig(Aclsubs); end %% 2. ReEig = real(eigVals); plot(rho, ReEig(1, :)); hold on plot(rho, ReEig(2, :), 'r'); hold on
 %% Investigate the Fact that a LTV Stability Cannot be Inferred from LTI % Stability % ------------------------------------------------------------------------- % script : exercise_LTI_LTV_Stability % ------------------------------------------------------------------------- % Author : Christian Hoffmann % Version : October, 27th 2015 % Copyright: CH, 2013 % Update : PC, 2015 % ------------------------------------------------------------------------- % % 1. Define plant % 2. Plot phase diagrams for various scenarios % % ------------------------------------------------------------------------- %% Initialization clc;clear all;close all;warning off;s = tf('s'); % Add subdirectories to path addpath(genpath('.')) thisdate = datestr(now, 'yyyy-mm-dd_HH-MM'); %% 1. Plant Definition % Parameterized plant definition A = @(k, b, m) [ 0 1 ;... -k -b ]; x0 = [0; 1]; k1 = 3; k2 = 1/3; b1 = 0.5; b2 = 0; [V1, D1] = eig(A(k1, b2, 1)) [V2, D2] = eig(A(k2, b2, 1)) % Draw phase portraits x10_grid = -1:2:1; x20_grid = -1:2:1; x0_grid = combvec(x10_grid, x20_grid); % x0_grid = x0_grid(:, 8); time = 0:0.01:100; colors = {'k', 'b', 'r'}; sys{1} = ss(A(k1, b2, 1), zeros(2, 1), eye(2), zeros(2, 1)); sys{2} = ss(A(k2, b2, 1), zeros(2, 1), eye(2), zeros(2, 1)); % sys{3} = ss(A(k1, b2, 1), zeros(2, 1), eye(2), zeros(2, 1)); figure(1); hold on % phasePlotCompute(sys, x0_grid, time, colors) [~,~,x1] = initial(sys{1},x0,10); [~,~,x2] = initial(sys{2},x0,20); plot(x1(:,1),x1(:,2),'r',x2(:,1),x2(:,2),'k') xlabel('$y$','Interpreter','Latex') ylabel('$\dot{y}$','Interpreter','Latex') axis([-2 2 -2 2]) grid on %% boolSwitchingLaw = 0; boolSmoothKFunction = 0; sim('model_LTI_LTV_Stability') x_sys{1, 1} = x.signals.values; figure(1); hold on phasePlot(x_sys, {'k'}, 2) \ No newline at end of file