summaryrefslogtreecommitdiff
path: root/3432/CH9/EX9.7/Ex9_7.sce
blob: cfe5028dce60b4754df9fc69398035d093e9a7c9 (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
//Example 9.7
//Analysis and design of the system with limit cycle using the root locus. 
xdel(winsid())//close all graphics Windows
clear;
clc;
//------------------------------------------------------------------
//System transfer function and its root locus 

s=poly(0,'s');
num=0.1;
den=(s^2+0.2*s+1)*(s);
Gs=syslin('c',num/den);

//Root locus
evans(Gs,40)
title(["Root locus of", "$(0.1/s(s^2+0.2*s+1)$"],'fontsize',3);
f=gca();
f.x_location = "origin"
f.y_location = "origin"
h=legend('');
h.visible = "off"
exec .\fig_settings.sci; // custom script for setting figure properties
//------------------------------------------------------------------
//Response of the system
figure;
//Response of the system
K=0.5;
i=[1 4 8];
importXcosDiagram(".\Ex9_7_model.xcos")

for r=i
xcos_simulate(scs_m,4);
scs_m.props.context
plot(yt.time,yt.values)
end

xlabel('Time (sec.)');
ylabel('Amplitude');
title("Step response of the system",'fontsize',3);
exec .\fig_settings.sci; // custom script for setting figure properties
zoom_rect([0 0 150 9])

xset('font size',3);
xstring(80,1.6,"$r=1$");
xstring(80,4.6,"$r=4$");
xstring(80,8.2,"$r=8$");
//------------------------------------------------------------------
//System with notch compensation
D=123*(s^2+0.18*s+0.81)/(s+10)^2;

//Root locus
figure,
evans(Gs*D,40)
title(["Root locus including notch compensation"],'fontsize',3);
f=gca();
f.x_location = "origin"
f.y_location = "origin"
h=legend('');
h.visible = "off"
exec .\fig_settings.sci; //custom script for setting figure properties
zoom_rect([-14 -2 2 2])
//------------------------------------------------------------------
//Response of the system witth notch filter
figure;
K=0.5;
i=[2 4];
importXcosDiagram(".\Ex9_7_model_notch.xcos")

for r=i
xcos_simulate(scs_m,4);
scs_m.props.context
plot(yt.time,yt.values)
end

xlabel('Time (sec.)');
ylabel('Amplitude');
title("Step response of the system with notch filter",'fontsize',3);
exec .\fig_settings.sci; //custom script for setting figure properties
xset('font size',3);
xstring(30,2.2,"$r=2$");
xstring(34,3.75,"$r=4$");
//------------------------------------------------------------------