clear all close all % For the process P=1/(s^2+4*s+4), design a digital controller by emulation % of a continuous design in order to satisfy the following requirments. %%%% REQUIREMENTS %%%%%%%%%%%%%%%%%% % - error at steady state =0 wrt to a step disturbance d % - s% < 30% (zita_c> 0.35, i.e. phase_margin > 35°) % - ta5% <= 3 s (ta5%=3/zita_c/omega_c ==> omega_c >= 2.86 rad/s) % - Ts = 80 ms (delay at omega_c: in terms of phase, % a decrase of phase margin of about omega_c*Ts/2) % plant to be controlled s=tf('s'); P=1/(s^2+4*s+4); C1=1/s; % controller implementing an integral action with gain =1 % open loop function F1=C1*P; % evaluate the cross. freq and phase margin figure, margin(F1) % increase the integral gain by 10 and introduce a zero in s=-0.4, then the tf of the controller is given by C2 C2=10*(s/0.4+1)/s; F2=C2*P; % evaluate the cross. freq and phase margin figure, margin(F2) figure bode(F1,F2) hold on grid on legend % evaluate the closed loop system for the two different cases (C1 and C2) W1=feedback(F1,1); W2=feedback(F2,1); figure step(W1,W2) legend % design the corresponding digital controller Ts=0.08; % (omega_s=2*pi/Ts approx 80 rad/s, check if omega_s is about 5-10 times omega_c % delay at omega_c (about 4 rad/s), in terms of phase, about -omega_c*Ts/2=-4*0.04=-0.16 rad % => decrase of phase margin of about 0.16 rad = 9.2 degrees % discret equivalent tf by using Tustin D1=c2d(C2,Ts,'tustin'); % anti-aliasing filter - a pole at frequency omega_f such that omega_f>omega_c omega_s=2*pi/Ts; % sampling freq. omega_f=omega_s/2.1; % frequency for the pole of anti-aliasing filter Fa=1/(s/omega_f+1); scheme_exam_IA_13_June_2024