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