Mercurial > hg > trimatlab
view mt_get_transmat_at.m @ 18:062d46712995 tip
Moved mc_global_info1 back to public folder
author | samer |
---|---|
date | Mon, 02 Apr 2012 21:50:43 +0100 |
parents | a6d5597bd922 |
children |
line wrap: on
line source
% mt_get_transmat_at - Get transition matrix nearest given point in information space. % % mt_get_transmat_at :: % mt_system ~'Melody Triangle system structure', % natural ~'voice Id (1 or greater)', % K:natural ~'size of transition matrix', % real ~'X-coordinate', % real ~'Y-coordinate' % -> [[K,K]] ~'transition matrix', % [[1,3]] ~'information coordinates'. % % The selected transition matrix will be shown using mt_show_transmat, function [T,P,I]=mt_get_transmat_at(Sys,Id,K,X,Y) logK=log(K); normpos = Sys.map([X;Y])'; target = normpos*logK; tmats = Sys.transmats{K}; info = Sys.info{K}; L = size(info,1); % distance from target d2 = sum((info(:,1:2) - repmat(target,L,1)).^2,2); M = find(d2==min(d2)); J = M(randnat(length(M))); T = tmats(:,:,J); I = info(J,:); if Sys.shuffle perm=randperm(K); T=T(perm,perm); end mt_show_transmat(Id,T,I); if nargin>1, P=Sys.revmap(I(1:2)'/logK); end end