%{ ELEC-E8116 Model-based Control Systems Exercise 5 %} clearvars; close all; clc; %% 1. % process G = tf([-6, 3],[50, 15, 1]); % G = 3*tf([-2 1],conv([5 1],[10 1])) % controller Gc = tf([14.427, 1], [12.7 0]); % loop transfer function L=G*Gc; % sensitivity function S=1/(1+L); % complementary sensitivity function T = ((1+L)^(-1))*L T=1-S; w = logspace(-2,1); figure(1); clf; bode(L,S,T,w) grid on; legend; [Gm, Pm, wcg, wcp] = margin(L) %{ Bandwidth can be defined in several ways: - heuristically it means the frequency range, in which control is efficient. - Sometimes the gain crossover frequency is used as the bandwidth, sometimes it is the frequency, at which the sensitivity function S first time crosses (1/sqrt(2)) = 0.707 (-3 dB) from below. - Perhaps the most common definition is that frequency, for which the complementary sensitivity function T crosses first time that value –3dB from above. %} [mag,phase]=bode(T,w); figure(2); clf; bode(T,w); grid on; %% 3. Qmax = 2000; % [W] Tmax = 1; % [K] T0max = 10; % [K] a = 100; % [W/K] Cv = 100e3; % [J/K] tau = Cv/a; % [s] G = (Qmax/Tmax)*(1/a)*tf(1,[tau, 1]) Gd = (T0max/Tmax)*tf(1,[tau, 1]) figure(3);clf; bode(G, Gd) grid on; legend;