wolffd@0: function plot_square_hhmm(ev) wolffd@0: % Plot the square shape implicit in the evidence. wolffd@0: % ev{i,t} is the value of node i in slice t. wolffd@0: % The observed node contains a velocity (delta increment), which is converted wolffd@0: % into a position. wolffd@0: % The Q2 node specifies which model is used, and hence which color wolffd@0: % to use: 1=red, 2=green, 3=blue, 4=black. wolffd@0: wolffd@0: Q1 = 1; Q2 = 2; Q3 = 3; F3 = 4; F2 = 5; Onode = 6; wolffd@0: wolffd@0: delta = cell2num(ev(Onode,:)); % delta(:,t) wolffd@0: Q2label = cell2num(ev(Q2,:)); wolffd@0: wolffd@0: T = size(delta, 2); wolffd@0: pos = zeros(2,T+1); wolffd@0: hold on wolffd@0: cols = {'r', 'g', 'b', 'k'}; wolffd@0: for t=2:T+1 wolffd@0: pos(:,t) = pos(:,t-1) + delta(:,t-1); wolffd@0: plot(pos(1,t), pos(2,t), sprintf('%c.', cols{Q2label(t-1)})); wolffd@0: if (t==2) wolffd@0: text(pos(1,t-1),pos(2,t-1),sprintf('%d',t)) wolffd@0: elseif (mod(t,20)==0) wolffd@0: text(pos(1,t),pos(2,t),sprintf('%d',t)) wolffd@0: end wolffd@0: end wolffd@0: