Matlab PI control first order system
107 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Divyani Rathod
le 1 Fév 2019
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.
Réponses (3)
Robert U
le 13 Nov 2017
Modifié(e) : Robert U
le 13 Nov 2017
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/179356/image.png)
Kind regards,
Robert
2 commentaires
Robert U
le 14 Août 2019
% 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)
partha das
le 5 Fév 2019
Modifié(e) : partha das
le 5 Fév 2019
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.
0 commentaires
Voir également
Catégories
En savoir plus sur PID Controller Tuning dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!