-
Notifications
You must be signed in to change notification settings - Fork 0
/
Graph_NDF.m
67 lines (48 loc) · 1.44 KB
/
Graph_NDF.m
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
clear all;clc;close all;
sys = open("sys.mat").sys;
perf_index = [1,1];
first_patch = [2,2];
second_patch = [3,3];
third_patch = [4,4];
fourth_patch = [5,5];
fifth_patch = [6,6];
patchConsidered = first_patch;
modeToDamp = 1;
resolution = 1000;%nb of points
KcMax = 10000;
Kc = 1/KcMax : KcMax/resolution : KcMax;
XiC = 0: 1/resolution:1;
w = 1 : 10e5/resolution : 10e5;
%System Variables
sysPatchConsidered = sys(patchConsidered(1),patchConsidered(2));
tfPatch = tf(sysPatchConsidered);
[Z,gain] = zero(tfPatch);
P = pole(tfPatch);
[rsys,info] = balred(sysPatchConsidered,2);
%maybe add static comp of other modes to gain
% [tempnum,tempdenum] = zp2tf([Z(end-2*(modeToDamp-1));Z(end-(2*(modeToDamp-1)+1))],[P(end-2*(modeToDamp-1));Z(end-(2*(modeToDamp-1)+1))],gain);
% troncatedtf = tf(tempnum,tempdenum);
%
% figure
% bodemag(tfPatch)
% hold on
% bodemag(troncatedtf)
% hold on
% bodemag(rsys)
%system gain
g0 = gain;
%zero to take into account
zerotaken = Z(end-2*(modeToDamp-1));
wz = abs(zerotaken);
XiZ = -cos(angle(zerotaken));
%pole to take into account
poletaken = P(end-2*(modeToDamp-1));
wp = abs(poletaken);
XiP = -cos(angle(poletaken));
gamma = wz/wp;
wc = wp;
Kc = 1;
for j = 1: length(XiC)
closedSystem(j) = sqrt(((wz^2-wp^2)^2+(2*XiZ*wz*wp)^2)/((wp^4-(wp^2+wc^2+2*XiZ*wc*Kc*wc*g0)*wp^2+wp^2*wc^2)^2+(-wp^3*(2*XiP*wp+2*XiC(j)*wc+g0*Kc*wc)+(2*XiP*wp*wc^2+2*XiC(j)*wc*wp^2+g0*wz^2*Kc*wc)*wp)^2));
end
plot(XiC,closedSystem)