-
Notifications
You must be signed in to change notification settings - Fork 1
/
obstruct.m
45 lines (33 loc) · 954 Bytes
/
obstruct.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
function scof = obstruct(cof,cofb,neq,nlag,nlead)
%
% construct the coefficients in the observable structure.
%
% inputs:
% cof structural coefficients
% cofb reduced form
% neq
% nlag
% nlead
% output:
% scof observable structure coefficients
%
% append negative identity to cofb
cofb = [cofb -eye(neq)];
scof = zeros(neq,neq*(nlag+1));
q = zeros(neq*nlead, neq*(nlag+nlead));
[rc,cc] = size(cofb);
q(1:rc,1:cc) = cofb;
if( nlead > 1 )
for i = 1:(nlead-1)
rows = i*neq + (1:neq);
q(rows,:) = shftrght( q((rows-neq),:), neq );
end
end
l = (1: neq*nlag);
r = (neq*nlag+1: neq*(nlag+nlead));
q(:,l) = -q(:,r) \ q(:,l);
minus = ( 1: neq*(nlag+1));
plus = (neq*(nlag+1)+1: neq*(nlag+1+nlead));
scof(:,neq+1:neq*(nlag+1)) = cof(:,plus)*q(:,l);
scof = scof + cof(:,minus);
return