Is anyone here able to help me out with this?
I am looking for how to code a unit step disturbance at 40 seconds.
my code is as follows
(live script)
oad response.dat
plot (time,response,'g');
title ('Actual response')
xlabel ('Time')
ylabel ('Amplitude')
hold on
s=tf('s')
K = 2;
tau = 3;
sysmod = exp(-s)*(K/(tau*s+1))
plot (time,response,'g');
hold on
step (sysmod,'k')
title ('System Model Step Response')
hold off
Applying the Hagglund-Astrom Tuning
theta = 0.27; % Defines the dead time in the process
kp = (0.14/K)+((0.28*tau)/(theta*K)) % Defines the Proportional element CORRECT
ki = ((0.33*theta) + ((6.8*theta*tau)/(10*theta+tau))) % Defines the Integral element CORRECT
haggast1 = feedback((kp + (ki/s))*sysmod,1); % Applying the Hagglund-Astrom tuning
step (haggast1,'g')
hold on
step (sysmod,'k')
%step (haggast1,40)
title ('Haggland-Astrom Tuning')
legend ('haggast1','sysmod')
hold off
Applying the Cohen and coon PI Tuning
theta1 = 0.275;
kp1 = (1/K)*(tau/theta1)*(0.9+(theta1/(12*tau))) % Defines the Proportional element CORRECT
ki1 = (theta1*(30+(3*(theta1/tau))) / (9+(20*(theta1/tau))))% Defines the Integral element CORRECT
CC = feedback((kp1 + (ki1/s))*sysmod,1); % Applying the Cohen Coon tuning
step (CC,'g')
hold on
step (sysmod,'k')
title ('Cohen Coon Tuning')
legend ('CC','sysmod')
hold off