-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcreatePlantModel.m
39 lines (35 loc) · 951 Bytes
/
createPlantModel.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
function Gp = createPlantModel(modelInfo)
mass = modelInfo.mass;
fr = modelInfo.fr;
dampingRatio = modelInfo.dampRatio;
modelType = lower(modelInfo.type);
switch modelType
case 'rigidbody'
num = 1;
den = [sum(mass),0,0];
Gp = tf(num,den);
case 'doublemassnoncolocated'
m1=mass(1);
m2=mass(2);
m=m1+m2;%ËŤÖĘÁżżéÄŁĐÍš˛ŐńĆľÂĘ
f1=fr(1);
w1=f1*2*pi;
z1=dampingRatio;
G1=tf(1,[m,0,0]);
G2=tf([2*z1*w1 w1*w1],[1,2*z1*w1,w1*w1]);
Gp=G1*G2;
case 'doublemasscolocated'
m1=mass(1);
m2=mass(2);
m=m1+m2;%ËŤÖĘÁżżéÄŁĐÍš˛ŐńĆľÂĘ
f1=fr(1);
w1=f1*2*pi;
% k = w1*w1*m1*m2/m;
z1 = dampingRatio;
% c1 = 2*z1*sqrt(m1*m2*k/m);
% w2 = sqrt(k/m2);
num = [(1+m2/m1),2*z1*w1,w1*w1];
den = (m1+m2)*[1,2*z1*w1,w1*w1,0,0];
Gp = tf(num,den);
end
end