summaryrefslogtreecommitdiff
path: root/3432/CH7/EX7.31/Ex7_31.sce
blob: 7e5955621c26bec9156368df9266a8ca0b2d48ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//Example 7.31
// Reduced-Order Estimator Design for DC Servo.

xdel(winsid())//close all graphics Windows
clear;
clc;
//------------------------------------------------------------------

// State space representation
//Transfer function model for DC Servo
s=poly(0,'s');
num=10;
den=s*(s+2)*(s+8);
Gs=syslin('c',num/den);
// State space representation
F=[-10 1 0;-16 0 1;0 0 0]
G=[0 0 10]';
H=[1 0 0];
J=0;
n=sqrt(length(F));
//Desired poles for the DC Servo system.
Pc=[-1.42 -1.04+2.14*%i -1.04-2.14*%i ]
// State feedback gain
K=ppol(F,G,Pc)
disp(K,'K=',"State feedback gain")

//------------------------------------------------------------------
//Estimator - error roots are at
//partioned system
Faa=F(1,1); Fab=F(1,2:3);
Fba=F(3,1); Fbb=F(2:3,2:3);
Ga=G(1);Gb=G(2:3);

Pe=[-4.24+4.24*%i, -4.24-4.24*%i]
// Observer gain matrix for system 
L=ppol(Fbb',Fab',Pe);
L=L';
disp(L,"L=" );
//------------------------------------------------------------------

//State feedback control law u=-Kx=-(K+[L*k2 0])[y xc]'; 
k1=K(1); k2=K(2:3);

//------------------------------------------------------------------
//compensator transfer function
s=poly(0,'s');
num=(-0.735+s)*(1.871+s);
den=poly([-0.990 + 6.12* %i, -0.990 - 6.12* %i] ,'s','roots')
Dcr=syslin('c',num/den);
disp(Dcr,'Dcr','compensator transfer function')
//------------------------------------------------------------------
//Root locus with reduced order compensator
evans(-Dcr*Gs)
zoom_rect([-8 -9 3 9])

f=gca();
f.x_location = "origin"
f.y_location = "origin"
xset("color",2);
h=legend('');
h.visible = "off"

//Title, labels and grid to the figure
exec .\fig_settings.sci; // custom script for setting figure properties
title('Root locus for DC servo reduced order controller','fontsize',3);
//------------------------------------------------------------------