Hi!
Editor -
Editor -
clc;
clear all;
close all;
nwd=25;
dwd=[1 2.5 0];
[n1,d1]=feedback(nwd,dwd,1,1)
disp('transfer function without derivative control is:')
sys1=tf(n1,d1)
td=0.18;nd=[td 1];dd=[0 1 ]
[ns,ds]=series(nd,dd,nwd,dwd);
[n2,d2]=feedback(ns,ds,1,1);
disp('transfer function with derivative control is:')
sys2=tf(n2,d2)
step(sys1)
grid
hold on
step(sys2)
legend('without','with pd')
Command Window -
n1 =
0 0 25
d1 =
1.0000 2.5000 25.0000
transfer function without derivative control is:
sys1 =
25
----------------
s^2 + 2.5 s + 25
Continuous-time transfer function.
dd =
0 1
transfer function with derivative control is:
sys2 =
4.5 s + 25
--------------
s^2 + 7 s + 25
Continuous-time transfer function.
2 - With PID Fuction
Editor -
clc;
clear all;
close all;
nwd=25;
dwd=[1 2.5 0];
sys=tf(nwd,dwd);
[n1,d1]=feedback(nwd,dwd,1,1)
disp('transfer function without derivative control is:')
sys1=tf(n1,d1)
step(sys1);
grid;
hold on;
kp=1;
ki=0;
kd=0.18;
c1=pid(kp,ki,kd);
step(feedback(c1*sys,1));
legend('without','with pd')
Command Window -
n1 =
0 0 25
d1 =
1.0000 2.5000 25.0000
transfer function without derivative control is:
sys1 =
25
----------------
s^2 + 2.5 s + 25
Continuous-time transfer function.
3 - PID Tuning
Editor -
clc;
close all;
clear all;
nwd=25;
dwd=[1 2.5 0];
sys=tf(nwd,dwd);
[n1,d1]=feedback(nwd,dwd,1,1);
disp('transfer fucntion without derivative control is:')
sys1=tf(n1,d1)
step(sys1);
grid;
hold on;
kp=1;ki=0;kd=0.18;
c1=pid(kp,ki,kd)
step(feedback(c1*sys,1));
hold on;
kp=0.8;ki=0.6;kd=0.18;
c2=pid(kp,ki,kd)
step(feedback(c2*sys,1));
legend('without','with pd','with pid')
[c3,info]=pidtune(sys,'pid')
figure;
step(feedback(c3*sys,1));
grid;
Command Window -
transfer fucntion without derivative control is:
sys1 =
25
----------------
s^2 + 2.5 s + 25
Continuous-time transfer function.
c1 =
Kp + Kd * s
with Kp = 1, Kd = 0.18
Continuous-time PD controller in parallel form.
c2 =
1
Kp + Ki * --- + Kd * s
s
with Kp = 0.8, Ki = 0.6, Kd = 0.18
Continuous-time PID controller in parallel form.
c3 =
1
Kp + Ki * --- + Kd * s
s
with Kp = 0.527, Ki = 0.337, Kd = 0.183
Continuous-time PID controller in parallel form.
info =
struct with fields:
Stable: 1
CrossoverFrequency: 4.4525
PhaseMargin: 83.8783
0 comments:
Post a Comment