% ELEC-E8116 Model-based Control Systems % Exercise 3 %% clearvars; close all; clc; %% 1.b: state-space k1 = 1; k2 = 4; b1 = 0.2; b2 = 0.1; m1 = 1; m2 = 2; A = [0 0 1 0; 0 0 0 1; -k1/m1 k1/m1 -b1/m1 b1/m1; k1/m2 -(k1+k2)/m2 b1/m2 -(b1+b2)/m2]; B = [0 0;0 0; 1/m1 0; 0 1/m2]; C = [1 0 0 0; 0 1 0 0]; D = [0 0 ; 0 0]; Gss = ss(A, B, C, D); %% 1.c: singular values figure(1);clf;sigma(A, B, C, D); %% 1.d.: H-inf norm [Hinf,fpeak] = hinfnorm(Gss, 0.001) % 20lgx = 21.2 x = 10^(21.2/20) %% 2. g11 = tf([10 10],[1 0.2 100]); g12 = tf(1,[1 1]); g21 = tf([1 2],[1 0.1 10]); g22 = tf([5 5],[1 5 6]); % transfer function G = [g11, g12; g21, g22] % state-space representation Gss = ss(G) % minimal realization Gssm = minreal(G) % or Gss % obtain matrices [Am, Bm, Cm, Dm] = ssdata(Gssm) figure(2);clf; sigma(Am, Bm, Cm, Dm) %% 3. % a. G1a1 = tf([2 6 4],[1 7 12 0]); G1a2 = tf([1 2],[1 4 3]); G1 = [G1a1, G1a2] pole(G1) tzero(G1) % G must be in state-space form G1ss = ss(G1) G1m = minreal(G1ss) pole(G1m) % b. G2a11 = tf(1, [1 1]); G2a12 = tf([1 3], [1 -1 -2]); G2a21 = tf(10, [1 -2]); G2a22 = tf(5, [1 3]); G2 = [G2a11, G2a12; G2a21, G2a22] pole(G2) tzero(G2) G2ss = ss(G2) G2m = minreal(G2ss) pole(G2m) tzero(G2m) %% Gsys = [0 100; 0 0]; % Gsys' % eigenvalues eig(Gsys) % singular values svd(Gsys) sqrt(eig(Gsys'*Gsys))