0% found this document useful (0 votes)
9 views

Controller Design (LQG/PiD?

Matlab code
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Controller Design (LQG/PiD?

Matlab code
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Problem 3.

1 :
MATLAB Code:
clc;
clear all;
L=1.54*10^-3;
R=7.94;
K_w=inv(2*3.1416*243/60);
J=27.8*10^-7;
B=15*10^-6;
K_s=0.96;
A = [ -R/L -K_w/L 0;
K_s/J -B/J 0;
0 1 0 ];
B = [1/L; 0; 0];
C=[0 0 1];
D=0;
sys=ss(A,B,C,D);
con=pid(1,.005,0.001);
figure(1)
bode(sys*con)
sys_cl=feedback(sys*con,1);
figure(2)
step(sys)
hold on
step(sys_cl,'r')
hold off

Fig 3.1: Close-loop figure.

1
Problem 3.2 :
MATLAB Code:
clc;
clear all;
L=1.54*10^-3;
R=7.94;
K_w=inv(2*3.1416*243/60);
J=27.8*10^-7;
B=15*10^-6;
K_s=0.96;
A = [ -R/L -K_w/L 0;
K_s/J -B/J 0;
0 1 0 ];
B = [1/L; 0; 0];
C=[1 0 0];
D=0;
sys=ss(A,B,C,D);
con=pid(0.1,225,0.000002);
figure(1)
bode(sys*con)
sys_cl=feedback(sys*con,1);
figure(2)
step(sys)
hold on
step(sys_cl,'r')
hold off

Fig 3.2: Close-loop figure.

2
Problem 3.3 :

MATLAB Code:
clc;
clear all;
L=1.54e-3;
R=7.94;
K_w=inv(2*3.1416*243/60);
J=27.8e-7;
B=15e-6;
K_s=0.96;
A = [ -R/L -K_w/L 0;
K_s/J -B/J 0;
0 1 0 ];
B = [1/L; 0; 0];
C=[0 1 0];
Kp = 0.0002;
Ki = 1;
Kd = 0.00000000076;
controller = pid(Kp,Ki,Kd);
sys_ol=ss(A,B,C,0);
figure(1)
bode(sys_ol*controller);
cl= feedback(sys_ol*controller,1);
figure(2)
step(sys_ol)
hold on
step(cl,'r')
figure(3)
step(cl)

Fig 3.3: Close-loop comparison figure.

3
MATLAB Code:
Problem 3.4 :
clc;
clear all;
L=1.54e-3;
R=7.94;
K_w=inv(2*3.1416*243/60);
J=27.8e-7;
B=15e-6;
K_s=0.96;
A = [ -R/L -K_w/L 0;
K_s/J -B/J 0;
0 1 0 ];
B = [1/L; 0; 0];
C = [1, 0, 0;
0, 1, 0;
0, 0, 1];
Kp=90000;
Ki=0.5;
Kd=0.0000003;
controller = pid(Kp,Ki,Kd);
sys_ol=ss(A,B,C,0);
sys_tf=tf(sys_ol)
figure(1)
bode(sys_ol*controller);
cl= feedback(sys_ol*controller,1,1,1);
figure(2)
step(sys_ol)
hold on
step(cl,'r')
figure(3)
step(cl)
Fig.-3.4: Open-loop and close-loop comparison figure

Performance analysis Table:

Function 𝑲𝑷 𝑲𝑰 𝑲𝑫 Rise Settling Overshoo Steady


, Time, Time, sec t of % -state
sec Error
C matrix
[0, 0, 1] 1 0.005 0.001 0.0875 0.155 0 1
[1, 0, 0] 0.1 225 0.000002 2.11 0.0882 0 1
[0, 1, 0] 0.000 1 0.00000000 0.0858 0.153 0 1
2 76
[1, 0, 0; 0.001 1.709 0 N/A 0 NaN Inf
0, 1, 0; 0, 9
N/A 0 NaN Inf
0,1]
N/A 0 NaN Inf

You might also like