%{ ELEC-E8116 Model-based Control Systems Exercise 6 %} clearvars; close all; clc; %% 2. k = [2, 2.5, 3]; tau = [2, 2.5, 3]; theta = [2, 2.5, 3]; T = 4; dG1 = tf([T, 0.2],[(T/2.4) , 1]) dG2 = dG1 * tf([1, 1.6, 1],[1, 1.4 , 1]); figure(1);clf; for ii = 1:3 for jj = 1:3 for kk = 1:3 Gp = tf(k(ii),[tau(jj), 1], 'InputDelay', theta(kk)); G = tf(k(ii),[tau(jj), 1]); lI = (Gp-G)/G; bodemag(lI, 'b:') hold on; end end end bodemag(dG1, 'k-'); bodemag(dG2, 'r--'); yline(1); % ylim([-10, 10]); legend('Gp: dotted', 'dG1: solid', 'dG2: dashed'); %% 3. % process G = tf([-6, 3],[50, 15, 1]); % G = 3*tf([-2 1],conv([5 1],[10 1])) % controller s= tf('s'); % K = 1.136; K = 0.31; Ti=12.7; Gc = K*(1+(1/(Ti*s))); % loop transfer function L=G*Gc; % sensitivity function S=1/(1+L); % complementary sensitivity function T = ((1+L)^(-1))*L T=1-S; dG = tf([10, 0.33],[(10/5.25), 1]); w = logspace(-2,1); figure(2); clf; bodemag(T,w,'b-'); hold on; bodemag(1/dG, w, 'r--') grid on;