0% found this document useful (0 votes)
11 views12 pages

Cep Control

Uploaded by

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

Cep Control

Uploaded by

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

Transfer Function:

Code:

clear all
clc
A=[0 1;-0.152 -0.152];
B=[0;0.017];
C=[1 0];
D=0;
sys=ss2tf(A,B,C,D);
[num,denum]=ss2tf(A,B,C,D);
g=tf(num,denum)

Result:

Step Response:
Code:
clear all
clc
A=[0 1;-0.152 -0.152];
B=[0;0.017];
C=[1 0];
D=0;
sys=ss2tf(A,B,C,D);
[num,denum]=ss2tf(A,B,C,D);
g=tf(num,denum)
stepinfo(g);
h=feedback(g,1);
stepinfo(h);
hold on
s=tf('s');
P=0.017/(s^2+0.152*s+0.152)
step(P)
Result:
VZ

Step Info:

 Simulink Result:
Ramp Response:
Impulse Response:
Canonical Form:
Code:
num=[0 0.017 0];
denum=[1 0.152 0.152];
Gp=tf(num,denum);

GpssObs = canon(Gp,'companion');
GpssObsA = GpssObs.A
GpssObsB = GpssObs.B
GpssObsC = GpssObs.C
GpssObsD = GpssObs.D

Result:
Roots of Transfer Function:

Poles and Zeros Map:


clear all
clc
A=[0 1;-0.152 -0.152];
B=[0;0.017];
C=[1 0];
D=0;
sys=ss2tf(A,B,C,D);
[num,denum]=ss2tf(A,B,C,D);
g=tf(num,denum)
stepinfo(g)
pzmap(g)
Ruth Hurwitz Stability Criterion:
MATLAB Code:
clc;
disp(' ')
D=input('Input coefficients of characteristic equation,i.e:[an an-1 an-2 ...
a0]= ');
l=length (D);
disp(' ')
disp('----------------------------------------')
disp('Roots of characteristic equation is:')
roots(D)
if mod(l,2)==0
m=zeros(l,l/2);
[cols,rows]=size(m);
for i=1:rows
m(1,i)=D(1,(2*i)-1);
m(2,i)=D(1,(2*i));
end
else
m=zeros(l,(l+1)/2);
[cols,rows]=size(m);
for i=1:rows
m(1,i)=D(1,(2*i)-1);
end
for i=1:((l-1)/2)
m(2,i)=D(1,(2*i));
end
end
for j=3:cols

if m(j-1,1)==0
m(j-1,1)=0.001;
end

for i=1:rows-1
m(j,i)=(-1/m(j-1,1))*det([m(j-2,1) m(j-2,i+1);m(j-1,1) m(j-1,i+1)]);
end
end
disp('--------The Routh-Hurwitz array is:--------'),m
% --------------------End of Bulding array--------------------------------
% Checking for sign change
Temp=sign(m);a=0;
for j=1:cols
a=a+Temp(j,1);
end
if a==cols
disp(' ----> System is Stable <----')
else
disp(' ----> System is Unstable <----')
end

Results:

Root locus on Matlab:


Using PID Tuner:
Final Code after PID Tuner:
clear all
clc
A=[0 1;-0.152 -0.152];
B=[0;0.017];
C=[1 0];
D=0;
sys=ss2tf(A,B,C,D);
[num,denum]=ss2tf(A,B,C,D);
g=tf(num,denum);
stepinfo(g);
hold on
Kp=285.8179;
Ki=51.5319;
Kd=396.3167;
x=pid(Kp,Ki,Kd);
y=feedback(x*g,1);
stepinfo(y)
step(y)
Simulink Model:

You might also like