Matlab PI control first order system

357 次查看(过去 30 天)
MikeSv
MikeSv 2017-11-13
评论: Robert U 2019-8-14
Hi everyone. Iam quite new to Control theory and I have a question regarding PI Control using Matlab.
I have a first order transfer function :
G(s) = 5/(s+1)
and I try to use Matlab to form a feedback loop using a PI controller with the following code:
s = tf('s');
Kp = 1;
Ki = 1;
C = Kp + Ki/s
G = tf([5],[1 1])
figure(1)
step(G)
H = feedback(C*G,1)
figure(2)
step(H)
When I plot the step response of G, it goes from zero to five like expected, but when I plot the feedback response it only goes from zero to 1. Changing Kp and Ki does not have any effect.
Any help would be great!
Thanks in advance,
/M
  1 个评论
Divyani Rathod
Divyani Rathod 2019-2-1
How can i calculate Kp ki value for Peak overshoot <=11%, settling time<=5s. Transfer function is 3.24/15.24s+1 (My calculated value is, kp = 7.2152 and ki = 9.1061, zeta = 0.5749, w_n = 1.3916); (using state space and without state space) and also How can i calculate Fractional kp and ki.

请先登录,再进行评论。

回答(3 个)

Robert U
Robert U 2017-11-13
编辑:Robert U 2017-11-13
Hello MikeSv:
The system response is correct from my point of view. The desired response value of step-function is "1". The uncontrolled system G is responding with a gain of "5". The controlled system instead is responding with "1" as desired.
Edit:
The change of Kp and Ki have - of course - an effect. Due to automatic scaling it might be you did not mention.
Kind regards,
Robert
  2 个评论
bryce howard
bryce howard 2019-7-24
Hey Robert, how did you get Ki and Kp to display like that?
Robert U
Robert U 2019-8-14
% define transfer functions
s = tf('s');
C =@(Kp,Ki) Kp + Ki/s;
G = tf([5],[1 1]);
% define parameter combinations
Kp = [1,2,4,1,1];
Ki = [1,1,1,2,4];
% create figure
figure
ah = axes;
hold(ah,'on');
% loop through given combinations of Kp and Ki
for ik = 1:length(Kp)
H = feedback(C(Kp(ik),Ki(ik))*G,1);
step(H)
end
% create cell array of legend entries
cLegend = arrayfun(@(Kp,Ki) sprintf('Kp = %i, Ki = %i',Kp,Ki),Kp,Ki,'UniformOutput',false);
% add legend to figure
legend(ah,cLegend)

请先登录,再进行评论。


MikeSv
MikeSv 2017-11-13
Hi and thank you so much for the replies!
What I don't understand is, when I have my open loop system, and I want the output to be 5 when the input is 1 (a unit step). What happens to my DC Gain in the closed loop? I expected my output to be 5 as well in the closed loop, just with in example a faster rise time when changing the value of the P controller.
Thanks again,
M

partha das
partha das 2019-2-5
编辑:partha das 2019-2-5
OLTF is 5/(s+1). In this case DC gain is 5 (obtained by setting s=0 in the OLTF).
Your CLTF is 5/(s+1) when you use Kp=1 and Ki=1. So in this case DC gain is 1. As a result when you apply an unit step input to this CLTF, your steady state output will be 1 i.e. the steady state error (reference step input of magnitude 1 - steady output of 1) is 0. In fact for any values of Kp and Ki, you will get a steady state error of 0 because the PI controller always tracks the reference input perfectly.

类别

Help CenterFile Exchange 中查找有关 Time and Frequency Domain Analysis 的更多信息

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by