comparison toolboxes/FullBNT-1.0.7/bnt/inference/dynamic/@stable_ho_inf_engine/test_ho_inf_enginge.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function [engine,engine2] = test_ho_inf_enginge(order,T)
2
3 assert(order >= 1)
4 % Model a SISO system, i. e. all node are one-dimensional
5 % The nodes are numbered as follows
6 % u(t) = 1 input
7 % y(t) = 2 model output
8 % z(t) = 3 noise
9 % q(t) = 4 observed output = noise + model output
10
11 ns = [1 1 1 1];
12
13 % Model a linear system, i.e. there are no discrete nodes
14 dn = [];
15
16 % Modeling of connections within a time slice
17 intra = zeros(4);
18 intra(2,4) = 1; % Connection y(t) -> q(t)
19 intra(3,4) = 1; % Connection z(t) -> q(t)
20
21 % Connections to the next time slice
22 inter = zeros(4,4,order);
23 inter(1,2,1) = 1; % u(t) -> y(t+1);
24 inter(2,2,1) = 1; %y(t) -> y(t+1);
25 inter(3,3,1) = 1; %z(t) -> z(t+1);
26
27 if order >= 2
28 inter(1,2,2) = 1; % u(t) -> y(t+2);
29 inter(2,2,2) = 1; % y(t) -> y(t+2);
30 end
31
32 for i = 3: order
33 inter(:,:,i) = inter(:,:,i-1); %u(t) -> y(t+i) y(t) -> y(t) +i
34 end;
35
36
37 % Compution of a higer order Markov Model
38 bnet = mk_higher_order_dbn(intra,inter,ns,'discrete',dn);
39 bnet2 = mk_dbn(intra,inter(:,:,1),ns,'discrete',dn)
40
41
42 %Calculation of the number of nodes with different parameters
43 %There is one input and one output nodes 2
44 %There are two different disturbance node 2
45 %There are order +1 nodes for y 1 + order
46 numOfNodes = 5 + order;
47
48 % First input node
49 bnet.CPD{1} = gaussian_CPD(bnet,1,'mean',0);
50 bnet2.CPD{1} = gaussian_CPD(bnet,1,'mean',0);
51 % Modeled output
52 bnet.CPD{2} = gaussian_CPD(bnet,2,'mean',0);
53 bnet2.CPD{2} = gaussian_CPD(bnet,2,'mean',0);
54 %Disturbance
55 bnet.CPD{3} = gaussian_CPD(bnet,3,'mean',0);
56 bnet2.CPD{3} = gaussian_CPD(bnet,3,'mean',0);
57
58 %Qutput
59 bnet.CPD{4} = gaussian_CPD(bnet,4,'mean',0);
60 bnet2.CPD{4} = gaussian_CPD(bnet,4,'mean',0);
61
62
63 %Output node in the second time-slice
64 %Remember that node number 6 is an example for
65 %the fifth equivalence class
66 bnet.CPD{5} = gaussian_CPD(bnet,6,'mean',0);
67 bnet2.CPD{5} = gaussian_CPD(bnet,6,'mean',0);
68
69 %Disturbance node in the second time slice
70 bnet.CPD{6} = gaussian_CPD(bnet,7,'mean',0);
71 bnet2.CPD{6} = gaussian_CPD(bnet,7,'mean',0);
72
73 % Modeling of the remaining nodes for y
74 for i = 7:numOfNodes
75 bnet.CPD{i} = gaussian_CPD(bnet,(i - 6)*4 + 7,'mean',0);
76 end
77
78 % Generation of the inference engine
79 engine = dv_unrolled_dbn_inf_engine(bnet,T);
80 engine2 = jtree_unrolled_dbn_inf_engine(bnet,T);
81
82
83
84
85
86
87