-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathso2ss.m
More file actions
36 lines (30 loc) · 760 Bytes
/
so2ss.m
File metadata and controls
36 lines (30 loc) · 760 Bytes
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
function [a,b,c,d]=so2ss(M, Dso, K, Bt, Cd, Cv, Ca)
% SO2SS [a,b,c,d]=SO2SS(M, C, K, Bt, Cd, Cv, Ca) returns the state system
% [xdot ] [ 0 I ][ x ] [ 0 ]
% [ ] = [ ][ ] + [ ] [u]
% [xddot] [-M^-1*K -M^-1*C][xdot] [M^-1*Bs]
%
% y = C z + D u
%
% where z = [x' xdot']'
%
% given the second order form equations
% M xddot + C xdot + K x=Bs u
% y = Cd x + Cv xdot + Ca xddot
% Copyright Joseph C. Slater, 2003
% Updates Dec 11, 2017 to include Cd, Cv, and Ca.
l=size(M,1);
if nargin==4
Cd = eye(l)
Ca = zeros(l)
Cv = Ca
elseif nargin<4
Bt=eye(l)
end
if nargin<3
K=D;D=0*K;
end
a=[zeros(l) eye(l);-M\K -M\Dso];
b=[zeros(l,size(Bt,2)); M\Bt];
c=[Cd-Ca*(M\K), Cv-Ca*(M\Dso)]
d=Ca*(M\Bt);