-
-
Save anonymous/588a2ceb6ccd7a25b4bc to your computer and use it in GitHub Desktop.
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 outpu…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% 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') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment