First order PID controller
Hi,
I am having a bit of bother with a PID controller I am creating on MATLAB. I have the below transfer function for my system, which i’ve to incorporate a PID controller into.
clc
clear all
% Implementing T.F G(s) = 85/(42s+1)
num = [85]; %Numerator of Transfer function (DC Gain k)
den = [42 1]; %Denominator of Transfer function (Time constant tau +1)
Gs = tf([num],[den],’InputDelay’,10) %a transfer function with a lag tim); %transfer function
u = 1; %unit step input
% plotting the graph
figure(1)
[x,y]=step(u*Gs);
plot(y,x);
xlabel(‘time /s’); ylabel(‘Level’);
I have tried using the below code for the PID controller, which doesn’t seem to have the same times. Also on all controllers i’ve done the step response never got to 1 without tuning before.
% Implementing T.F G(s) = 85/(42s+1)
num = [85]; %Numerator of Transfer function (DC Gain k)
den = [42 1]; %Denominator of Transfer function (Time constant tau +1)
Gs= tf(num,den); %TF function
H=[1]; %feedback
M=feedback(Gs,H);
step(M)
grid on
When I add the PID controller script I no longer get anything I expect. I set Kp to 2, which does quicken the response, however I expect some overshoot. I have increased Kp bu different higher values and it only provides quicker respnses without overshoot. This is not how any of my other controllers have operated.
%%
Kp = 2;
Ki = 0;
Kd = 0;
Gc=pid(Kp,Ki,Kd)
Mc=feedback(Gc*Gs,H)
step(Mc)
grid on
I know I am doing something wrong, but can’t see what. Is there anyone that can look this over and assist? I am using Matlab online as I do not have permission to download additional content on my laptop as IT won’t allow it. You may have also noticed that there is no delay added to the scripts. This is due to it not working if I do.Hi,
I am having a bit of bother with a PID controller I am creating on MATLAB. I have the below transfer function for my system, which i’ve to incorporate a PID controller into.
clc
clear all
% Implementing T.F G(s) = 85/(42s+1)
num = [85]; %Numerator of Transfer function (DC Gain k)
den = [42 1]; %Denominator of Transfer function (Time constant tau +1)
Gs = tf([num],[den],’InputDelay’,10) %a transfer function with a lag tim); %transfer function
u = 1; %unit step input
% plotting the graph
figure(1)
[x,y]=step(u*Gs);
plot(y,x);
xlabel(‘time /s’); ylabel(‘Level’);
I have tried using the below code for the PID controller, which doesn’t seem to have the same times. Also on all controllers i’ve done the step response never got to 1 without tuning before.
% Implementing T.F G(s) = 85/(42s+1)
num = [85]; %Numerator of Transfer function (DC Gain k)
den = [42 1]; %Denominator of Transfer function (Time constant tau +1)
Gs= tf(num,den); %TF function
H=[1]; %feedback
M=feedback(Gs,H);
step(M)
grid on
When I add the PID controller script I no longer get anything I expect. I set Kp to 2, which does quicken the response, however I expect some overshoot. I have increased Kp bu different higher values and it only provides quicker respnses without overshoot. This is not how any of my other controllers have operated.
%%
Kp = 2;
Ki = 0;
Kd = 0;
Gc=pid(Kp,Ki,Kd)
Mc=feedback(Gc*Gs,H)
step(Mc)
grid on
I know I am doing something wrong, but can’t see what. Is there anyone that can look this over and assist? I am using Matlab online as I do not have permission to download additional content on my laptop as IT won’t allow it. You may have also noticed that there is no delay added to the scripts. This is due to it not working if I do. Hi,
I am having a bit of bother with a PID controller I am creating on MATLAB. I have the below transfer function for my system, which i’ve to incorporate a PID controller into.
clc
clear all
% Implementing T.F G(s) = 85/(42s+1)
num = [85]; %Numerator of Transfer function (DC Gain k)
den = [42 1]; %Denominator of Transfer function (Time constant tau +1)
Gs = tf([num],[den],’InputDelay’,10) %a transfer function with a lag tim); %transfer function
u = 1; %unit step input
% plotting the graph
figure(1)
[x,y]=step(u*Gs);
plot(y,x);
xlabel(‘time /s’); ylabel(‘Level’);
I have tried using the below code for the PID controller, which doesn’t seem to have the same times. Also on all controllers i’ve done the step response never got to 1 without tuning before.
% Implementing T.F G(s) = 85/(42s+1)
num = [85]; %Numerator of Transfer function (DC Gain k)
den = [42 1]; %Denominator of Transfer function (Time constant tau +1)
Gs= tf(num,den); %TF function
H=[1]; %feedback
M=feedback(Gs,H);
step(M)
grid on
When I add the PID controller script I no longer get anything I expect. I set Kp to 2, which does quicken the response, however I expect some overshoot. I have increased Kp bu different higher values and it only provides quicker respnses without overshoot. This is not how any of my other controllers have operated.
%%
Kp = 2;
Ki = 0;
Kd = 0;
Gc=pid(Kp,Ki,Kd)
Mc=feedback(Gc*Gs,H)
step(Mc)
grid on
I know I am doing something wrong, but can’t see what. Is there anyone that can look this over and assist? I am using Matlab online as I do not have permission to download additional content on my laptop as IT won’t allow it. You may have also noticed that there is no delay added to the scripts. This is due to it not working if I do. pid controller MATLAB Answers — New Questions