view mt_show_transmat.m @ 18:062d46712995 tip

Moved mc_global_info1 back to public folder
author samer
date Mon, 02 Apr 2012 21:50:43 +0100
parents 4e61b949e73d
children
line wrap: on
line source
% mt_show_transmat - Display image of transition matrix for voice
%
% mt_show_transmat ::
%    natural ~'voice id'
%    [[K,K]] ~'transition matrix'
% -> action void.
%
% Also displays global information measures in bits in the title.

function mt_show_transmat(Id,T,I)
	figure(Id); 
	imagesc(T,[0,1]); 
	axis xy;
	if nargin<3, I=mc_global_info1(T,0.0001); end
	I=I/log(2); % convert to bits
	htit=title(sprintf('H=%.2f, R=%.2f, PI=%.2f',I(1),I(2),I(3)));
	addkbcallback(gcf);
	addkbcallback(gcf,@(k)show_eigs(Id,T));
	set(htit,'ButtonDownFcn',@(a,b)show_eigs(Id,T));
end

function show_eigs(Id,T) 
	figure(40);
	colormap prism;
	[V,D]=eig(T); d=diag(D);
	k=find(abs(d-1)<0.001);
	subplot(3,1,1); plot_cvec(diag(D)); 
	title(sprintf('%d: eigenvalues %s',Id,mat2str(d(k))));
	subplot(3,1,2); plot_cvec(sum(V)); title('sum eigenvectors');%ylim([-1,1]);
	subplot(3,1,3); plotseq(@plot_cvec,window(V)); title('eigenvector');
end