secret
Created

This is the problem statement %A LTI plant having a transfer function 20/s+2 is to be controlled using a %Proportional controller with gain kc and unity feedback. The sampling %interval t = 0:005 sec. Develop separate algorithms to do the following: % Control the plant for the following multi-step conditions as in Table 1. % Plot the plant output and control action c(t) vs t and m(t) vs t. Show % the setpoint r(t) on the same c(t) plot.

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
%% Clear workspace
clear
clc
 
%% inputs
 
G = tf([20],[1 2]) ; % G(s)
kp = 10 ; % kp of G
 
 
%% algorithm
 
t = [0.1:0.1:1] ; %time array
rt = 150 ; % r(t)
ess = 0.2*rt ; % steady state error
rtoveress = rt/ess ; %computing the rt / ess, ess is 20%
kc = (rtoveress-1)/kp ; %finding new kc
sys = (rt-ess)*G/kp ; % G response to control
cs = feedback(G,kc) ; % cltf of system
mt = step(sys, t) ; % storing values of step(sys) in plant
ct = step(cs, t) ; %storing values for controller action
hold on
%plotting
[AX,H1,H2] = plotyy (t, mt, t, ct) ;
 
 
 
t = [1:0.1:2] ; %time array
rt = 200 ; % r(t)
ess = 0.2*rt ; % steady state error
rtoveress = rt/ess ; %computing the rt / ess, ess is 20%
kc = (rtoveress-1)/kp ; %finding new kc
sys = (rt-ess)*G/kp ; % G response to control
cs = feedback(G,kc) ; % cltf of system
mt = step(sys, t) ; % storing values of step(sys) in plant
ct = step(cs, t) ; %storing values for controller action
%plotting
[AX,H1,H2] = plotyy (t, mt, t, ct) ;
 
t = [2:0.1:3] ; %time array
rt = 300 ; % r(t)
ess = 0.2*rt ; % steady state error
rtoveress = rt/ess ; %computing the rt / ess, ess is 20%
kc = (rtoveress-1)/kp ; %finding new kc
sys = (rt-ess)*G/kp ; % G response to control
cs = feedback(G,kc) ; % cltf of system
mt = step(sys, t) ; % storing values of step(sys) in plant
ct = step(cs, t) ; %storing values for controller action
%plotting
[AX,H1,H2] = plotyy (t, mt, t, ct) ;
 
t = [3:0.1:4] ; %time array
rt = 125 ; % r(t)
ess = 0.2*rt ; % steady state error
rtoveress = rt/ess ; %computing the rt / ess, ess is 20%
kc = (rtoveress-1)/kp ; %finding new kc
sys = (rt-ess)*G/kp ; % G response to control
cs = feedback(G,kc) ; % cltf of system
mt = step(sys, t) ; % storing values of step(sys) in plant
ct = step(cs, t) ; %storing values for controller action
%plotting
[AX,H1,H2] = plotyy (t, mt, t, ct) ;
 
% Plot Results - Plots plant system and control versus t on same plot
set(get(AX(1),'Ylabel'),'String','plant output m(t)') ;
set(get(AX(2),'Ylabel'),'String','control action c(t)') ;
xlabel('time t')% Set Axis Labels
title('Question 2 b')

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.