comparison mt_get_transmat_at.m @ 0:be936975f254

Initial check in.
author samer
date Wed, 01 Feb 2012 14:06:37 +0000
parents
children ffd7efa3e5c0
comparison
equal deleted inserted replaced
-1:000000000000 0:be936975f254
1 % mt_get_transmat_at - Get transition matrix near given point in information space.
2 %
3 % mt_get_transmat_at ::
4 % mt_system ~'Melody Triangle system structure',
5 % natural ~'voice Id (1 or greater)',
6 % K:natural ~'size of transition matrix',
7 % real ~'X-coordinate',
8 % real ~'Y-coordinate'
9 % -> [[K,K]] ~'transition matrix',
10 % [[1,3]] ~'information coordinates'.
11 %
12 % The selected transition matrix will be shown using mt_show_transmat,
13 % and it's information coordinates printed in the title of the main scatter plot.
14
15 function [T,I]=mt_get_transmat_at(Sys,Id,K,X,Y)
16 normpos = Sys.map([X;Y])';
17 target = normpos *log(K);
18 tmats = Sys.transmats{K};
19 info = Sys.info{K};
20 L = size(info,1);
21
22 % distance from target
23 d2 = sum((info(:,1:2) - repmat(target,L,1)).^2,2);
24 Mask = d2<=max(min(d2)*2,0.01);
25
26 M = find(Mask);
27 % J = M(argmax(info(M,3)));
28 J = M(1+floor(length(M)*rand));
29 T = tmats(:,:,J);
30 I = info(J,:);
31 %Mask=2*int16(Mask); Mask(J)=1;
32 %set(Sys.hScat{K},'CDATA',Mask); % scatc(info,Mask,16); rotate3d on;
33 figure(Sys.fig); title(sprintf('info: %.2f, %.2f, %.2f',I(1),I(2),I(3)));
34 %figure(50); title(sprintf('pos: %.2f, %.2f',normpos(1), normpos(2)));
35 %fprintf('normpos: %.2f, %.2f',normpos(1), normpos(2));
36 mt_show_transmat(Id,T);
37 end