Sie sind auf Seite 1von 17

%step response of open loop system

clc
clear all;
close all;
Ka=input('enter the gain value')
num=Ka*[43.748]
den=[1 10.42 36.48 52.1 26]
%figure(1)
xlabel('time')
ylabel('magnitude')
rlocus(num,den)
datacursormode('on')
grid on
%step response of uncompensated system
numu=Ka*[6.25 31.25]
denu=[1 10.42 36.48 52.156 26.093+43.75*Ka]
t=0:0.5:20;
c=step(numu,denu,t)
%figure(2)
plot(t,c)
xlabel('time')
ylabel('magnitude')
grid on
title('step response of uncompensated system')
stepinfo(c)
%step response of control compensated system
numc1=Ka*[6.25 93.75 312]
denc1=[1 20.42 140.69 417.05+25*Ka 547.7+196.25*Ka 261+400*Ka]
t=0:0.5:20;
c=step(numc1,denc1,t)
%figure(3)
plot(t,c)
xlabel('time')
ylabel('magnitude')
grid on
title('step response of control compensated system')
stepinfo(c)
%step response of PID compensated system
numc2=Ka*[1.5625 14.0625 33 8.75]
denc2=[1 10.42 36.48 52.15625+10.9375*Ka 26.09375+43.75*Ka 12.25*Ka]
t=0:0.5:20;
c=step(numc2,denc2,t)
%figure(4)
plot(t,c)
xlabel('time')
ylabel('magnitude')
grid on
title('step response of PID compensated system k=101')
stepinfo(c)
Output for uncompensated system:

enter the gain value2

Ka =

numc =

12.5000 62.5000

denc =

1.0000 10.4200 36.4800 52.1560 113.5930

ans =

struct with fields:

RiseTime: 1.4574

SettlingTime: 39.1036

SettlingMin: 0.2960

SettlingMax: 0.8895

Overshoot: 61.1847

Undershoot: 0

Peak: 0.8895

PeakTime: 4

>>

>> output for control unit compensated system

>> untitled10

gain

Ka =

2
numc1 =

12.5000 187.5000 624.0000

denc1 =

1.0e+03 *

0.0010 0.0204 0.1407 0.4671 0.9402 1.0610

c=

0.1307

0.4875

0.7030

0.6816

0.5867

0.5493

0.5696

0.5948

0.5989

0.5907

0.5850

0.5855

0.5881

0.5892

0.5886

0.5880

0.5878

0.5880
0.5882

0.5882

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

ans =

struct with fields:

RiseTime: 1.7440

SettlingTime: 8.2685

SettlingMin: 0.5493

SettlingMax: 0.7030
Overshoot: 19.5374

Undershoot: 0

Peak: 0.7030

PeakTime: 4

>>>> untitled10

gain2

Ka =

numc1 =

12.5000 187.5000 624.0000

denc1 =

1.0e+03 *

0.0010 0.0204 0.1407 0.4671 0.9402 1.0610

c=

0.1307

0.4875

0.7030

0.6816
0.5867

0.5493

0.5696

0.5948

0.5989

0.5907

0.5850

0.5855

0.5881

0.5892

0.5886

0.5880

0.5878

0.5880

0.5882

0.5882

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881

0.5881
0.5881

0.5881

0.5881

0.5881

ans =

struct with fields:

RiseTime: 1.7440

SettlingTime: 8.2685

SettlingMin: 0.5493

SettlingMax: 0.7030

Overshoot: 19.5374

Undershoot: 0

Peak: 0.7030

PeakTime: 4

>>

>>outout for PID control

>> >> PID

gain

Ka =

numc2 =

3.1250 28.1250 66.0000 17.5000

denc2 =

1.0000 10.4200 36.4800 74.0312 113.5938 24.5000

c=
0

0.2906

0.7430

0.9070

0.7654

0.5733

0.5266

0.6141

0.7112

0.7342

0.6972

0.6607

0.6598

0.6841

0.7049

0.7078

0.6996

0.6937

0.6961

0.7027

0.7074

0.7079

0.7065

0.7060

0.7073

0.7091

0.7103

0.7106

0.7105

0.7108

0.7113

0.7119
0.7123

0.7124

0.7125

0.7127

0.7129

0.7131

0.7133

0.7134

0.7135

ans =

struct with fields:

RiseTime: 1.5315

SettlingTime: 19.4728

SettlingMin: 0.5266

SettlingMax: 0.9070

Overshoot: 27.1277

Undershoot: 0

Peak: 0.9070

PeakTime: 4

>> untitled9

gain2

Ka =

numc2 =

3.1250 28.1250 66.0000 17.5000

denc2 =

1.0000 10.4200 36.4800 74.0312 113.5938 24.5000

c=
0

0.2906

0.7430

0.9070

0.7654

0.5733

0.5266

0.6141

0.7112

0.7342

0.6972

0.6607

0.6598

0.6841

0.7049

0.7078

0.6996

0.6937

0.6961

0.7027

0.7074

0.7079

0.7065

0.7060

0.7073

0.7091

0.7103

0.7106

0.7105

0.7108

0.7113

0.7119
0.7123

0.7124

0.7125

0.7127

0.7129

0.7131

0.7133

0.7134

0.7135

ans =

struct with fields:

RiseTime: 1.5315

SettlingTime: 19.4728

SettlingMin: 0.5266

SettlingMax: 0.9070

Overshoot: 27.1277

Undershoot: 0

Peak: 0.9070

PeakTime: 4

Control compensated when Ka=2


Control compensated when Ka=10

Uncompensated When Ka=10


uncompensated when Ka=2

open loop system


PID compensator when Ka=2

when Ka=10
Simulink block

PID controller
Uncompensated close loop:
control unit compensated

Das könnte Ihnen auch gefallen