summaryrefslogtreecommitdiff
path: root/3432/CH5/EX5.7/Ex5_7.sce
blob: 756952ff678db5c409dd8e828feb2de3f14dd2e7 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//Example 5.7
//Root locus for satellite control with a Collocated Flexibility. 

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

//------------------------------------------------------------------
//System transfer function with controller.

s=poly(0,'s');
NumD=(s+1);
DenD=(s+12);
D=NumD/DenD;

NumG=(s+0.1)^2+36
DenG=s^2*((s+0.1)^2+(6.6)^2)

G=NumG/DenG;

NumL=NumD*NumG;
DenL=DenD*DenG;

L=NumL/DenL;

zr=roots(NumL);
pl=roots(DenL);

//------------------------------------------------------------------
//Angle of departure.
//Find angle of departure from pole at phi1= - 0.1 + 6.6i
//(real poles don't have angle of departure,
//they move along real axis only) 
//psi1=angle[(Departing pole)- (zero at - 0.1 + 6.6i)]
[Mpsi1, psi1] = polar(pl(2)-zr(1))
psi1=real(psi1)*180/%pi;           //angle in degree

//psi2=angle[(Departing pole)- (zero at - 0.1 - 6.6i)]
[Mpsi2, psi2] = polar(pl(2)-zr(2)) 
psi2=real(psi2)*180/%pi;           //angle in degree

//psi3=angle[(Departing pole)- (zero at - 1)]
[Mpsi3, psi3] = polar(pl(2)-zr(3)) 
psi3=real(psi3)*180/%pi;           //angle in degree

//phi2=angle[(Departing pole)- (pole at 0)]
[Mphi2, phi2] = polar(pl(2)-pl(4)) 
phi2=real(phi2)*180/%pi;           //angle in degree

//phi3 is same as phi2, as pole is repeated at 0.
phi3=phi2;                         

//phi4=angle[(Departing pole)-(pole at - 0.1 - 6.6i )]
[Mphi4, phi4] = polar(pl(2)-pl(3)) 
phi4=real(phi4)*180/%pi;           //angle in degree

//phi5=angle[(Departing pole)- (pole at - 12 )]
[Mphi5, phi5] = polar(pl(2)-pl(1))
phi5=real(phi5)*180/%pi;           //angle in degree

//Therefore angle of departure phi1 at - 0.1 + 6.6i is
//phi1 = 180 + sum(angle to zeros) - sum(angle to poles)

phi1 = 180 + sum(psi1+psi2+psi3) - sum(phi2+phi3+phi4+phi5)

//angle contributions in figure 
figure(0)
plzr(L)
xset('font size',1.5)
xarrows([real(pl(1));real(pl(2))],[imag(pl(1));imag(pl(2))],0,2)
xarc(-13,1,2,2,0,phi5*64)
xstring(-11,0.05,"$\phi_5$")


xarrows([real(zr(3));real(pl(2))],[imag(zr(3));imag(pl(2))],0,4)
xarc(-2,1,2,2,0,psi3*64)
xstring(-0.7,1,"$\psi_3$")

xarrows([real(pl(4));real(pl(2))],[imag(pl(4));imag(pl(2))],0,5)
xarc(-1,1,2,2,0,phi2*64)
xstring(0.8,0.5,"$\phi_2,\,\phi_3$")


xarrows([real(pl(3));real(pl(2))],[imag(pl(3));imag(pl(2))],0,3)
xarc(-1,-6.6,2,2,0,phi4*64)
xstring(0.8,-7,"$\phi_4$")

xarrows([real(zr(2));real(pl(2))],[imag(zr(2));imag(pl(2))],0,6)
xarc(-1,-5,2,2,0,psi2*64)
xstring(0.8,-5.5,"$\psi_2$")

xarrows([real(zr(1));real(pl(2))],[imag(zr(1));imag(pl(2))],0,24)
xstring(0.3,5.5,"$\psi_1$")
xstring(0.3,6.5,"$\phi_1$")

exec .\fig_settings.sci; //custom script for setting figure properties
title(['Figure for computing a departure angle for',...
'$L(s)=\frac{s+1}{s+12}\frac{(s+0.1)^2+6^2}{s^2[(s+0.1)^2+6.6^2]}$'],...
'fontsize',3)
zoom_rect([-15 -8 5 8])
h=legend('');
h.visible = "off"

//------------------------------------------------------------------
//Root locus system transfer function with controller.
figure(1)
evans(L)
//Title, labels and grid to the figure
exec .\fig_settings.sci; //custom script for setting figure properties
title(['Root locus for','$L(s)=\frac{s+1}{s+12}\frac{(s+0.1)^2+6^2}...
{s^2[(s+0.1)^2+6.6^2]}$'],'fontsize',3)
zoom_rect([-15 -8 5 8])
h=legend('');
h.visible = "off"

//------------------------------------------------------------------