wolffd@0: function [engine,engine2] = test_ho_inf_enginge(order,T) wolffd@0: wolffd@0: assert(order >= 1) wolffd@0: % Model a SISO system, i. e. all node are one-dimensional wolffd@0: % The nodes are numbered as follows wolffd@0: % u(t) = 1 input wolffd@0: % y(t) = 2 model output wolffd@0: % z(t) = 3 noise wolffd@0: % q(t) = 4 observed output = noise + model output wolffd@0: wolffd@0: ns = [1 1 1 1]; wolffd@0: wolffd@0: % Model a linear system, i.e. there are no discrete nodes wolffd@0: dn = []; wolffd@0: wolffd@0: % Modeling of connections within a time slice wolffd@0: intra = zeros(4); wolffd@0: intra(2,4) = 1; % Connection y(t) -> q(t) wolffd@0: intra(3,4) = 1; % Connection z(t) -> q(t) wolffd@0: wolffd@0: % Connections to the next time slice wolffd@0: inter = zeros(4,4,order); wolffd@0: inter(1,2,1) = 1; % u(t) -> y(t+1); wolffd@0: inter(2,2,1) = 1; %y(t) -> y(t+1); wolffd@0: inter(3,3,1) = 1; %z(t) -> z(t+1); wolffd@0: wolffd@0: if order >= 2 wolffd@0: inter(1,2,2) = 1; % u(t) -> y(t+2); wolffd@0: inter(2,2,2) = 1; % y(t) -> y(t+2); wolffd@0: end wolffd@0: wolffd@0: for i = 3: order wolffd@0: inter(:,:,i) = inter(:,:,i-1); %u(t) -> y(t+i) y(t) -> y(t) +i wolffd@0: end; wolffd@0: wolffd@0: wolffd@0: % Compution of a higer order Markov Model wolffd@0: bnet = mk_higher_order_dbn(intra,inter,ns,'discrete',dn); wolffd@0: bnet2 = mk_dbn(intra,inter(:,:,1),ns,'discrete',dn) wolffd@0: wolffd@0: wolffd@0: %Calculation of the number of nodes with different parameters wolffd@0: %There is one input and one output nodes 2 wolffd@0: %There are two different disturbance node 2 wolffd@0: %There are order +1 nodes for y 1 + order wolffd@0: numOfNodes = 5 + order; wolffd@0: wolffd@0: % First input node wolffd@0: bnet.CPD{1} = gaussian_CPD(bnet,1,'mean',0); wolffd@0: bnet2.CPD{1} = gaussian_CPD(bnet,1,'mean',0); wolffd@0: % Modeled output wolffd@0: bnet.CPD{2} = gaussian_CPD(bnet,2,'mean',0); wolffd@0: bnet2.CPD{2} = gaussian_CPD(bnet,2,'mean',0); wolffd@0: %Disturbance wolffd@0: bnet.CPD{3} = gaussian_CPD(bnet,3,'mean',0); wolffd@0: bnet2.CPD{3} = gaussian_CPD(bnet,3,'mean',0); wolffd@0: wolffd@0: %Qutput wolffd@0: bnet.CPD{4} = gaussian_CPD(bnet,4,'mean',0); wolffd@0: bnet2.CPD{4} = gaussian_CPD(bnet,4,'mean',0); wolffd@0: wolffd@0: wolffd@0: %Output node in the second time-slice wolffd@0: %Remember that node number 6 is an example for wolffd@0: %the fifth equivalence class wolffd@0: bnet.CPD{5} = gaussian_CPD(bnet,6,'mean',0); wolffd@0: bnet2.CPD{5} = gaussian_CPD(bnet,6,'mean',0); wolffd@0: wolffd@0: %Disturbance node in the second time slice wolffd@0: bnet.CPD{6} = gaussian_CPD(bnet,7,'mean',0); wolffd@0: bnet2.CPD{6} = gaussian_CPD(bnet,7,'mean',0); wolffd@0: wolffd@0: % Modeling of the remaining nodes for y wolffd@0: for i = 7:numOfNodes wolffd@0: bnet.CPD{i} = gaussian_CPD(bnet,(i - 6)*4 + 7,'mean',0); wolffd@0: end wolffd@0: wolffd@0: % Generation of the inference engine wolffd@0: engine = dv_unrolled_dbn_inf_engine(bnet,T); wolffd@0: engine2 = jtree_unrolled_dbn_inf_engine(bnet,T); wolffd@0: wolffd@0: wolffd@0: wolffd@0: wolffd@0: wolffd@0: wolffd@0: