jointplotgen.m

来自「这是一个三面阵列的数学工具软件」· M 代码 · 共 71 行

M
71
字号
function [fit]=jointplotgen(K,A,B,C,fixmode,fixunit,laba,labb,labc,fs);
% [fit]=jointplotgen(K,A,B,C,fixmode,fixunit,laba,labb,labc,fs);
% program for producing jointplots in general
% 
% input: K,A,B,C core and component matrices
% 			fixmode: mode for which one unit is to be chosen
%		   fixunit: component for which joint plot is desired 
% 			laba,labb, labc (labels for A, B and C mode entities below each other)
%        fs: fontsize
% output: fit = percentage of info for component at hand, explained by 2dim plot 
[n,r1]=size(A);
[m,r2]=size(B);
[p,r3]=size(C);
clf
axes('pos',[.1 .1 .62 .825],'Fontsize',fs,'Box','on');	
% adjustment of aspectratio for printer 
if fixmode==1
   Gmat=zeros(r2,r3);
   Gmat(:)=K(fixunit,:)';
   Smat=B*Gmat*C';
   [P,D,Q]=svd(Smat,0);
   fit=D(1,1)^2+D(2,2)^2;
   fit=fit/ssq(Smat)*100;
   Bmat=(m/p)^.25*P(:,1:2)*D(1:2,1:2)^.5;
   Cmat=(p/m)^.25*Q(:,1:2)*D(1:2,1:2)^.5;
   min([Bmat;Cmat]);xmin=min(ans)-.1;
   max([Bmat;Cmat]);xmax=max(ans)+.1;
   axis([xmin xmax xmin xmax]);
   X=Bmat;id=labb;   
   text(X(:,1),X(:,2),id,'FontSize',fs);
   X=Cmat;id=labc;
   text(X(:,1),X(:,2),id,'FontSize',fs);
end;
if fixmode==2
   Gmat=zeros(r3,r1);
   K=permnew(K,r1,r2,r3);
   Gmat(:)=K(fixunit,:)';
   Smat=C*Gmat*A';
   [P,D,Q]=svd(Smat,0);
   fit=D(1,1)^2+D(2,2)^2;
   fit=fit/ssq(Smat)*100;
   Cmat=(p/n)^.25*P(:,1:2)*D(1:2,1:2)^.5;
   Amat=(n/p)^.25*Q(:,1:2)*D(1:2,1:2)^.5;
   min([Cmat;Amat]);xmin=min(ans)-.1;
   max([Cmat;Amat]);xmax=max(ans)+.1;
   axis([xmin xmax xmin xmax]);
   X=Cmat;id=labc;   
   text(X(:,1),X(:,2),id,'FontSize',fs);
   X=Amat;id=laba;
   text(X(:,1),X(:,2),id,'FontSize',fs);
end;
if fixmode==3
   Gmat=zeros(r1,r2);
   K=permnew(K,r1,r2,r3);
   K=permnew(K,r2,r3,r1);
   Gmat(:)=K(fixunit,:)';
   Smat=A*Gmat*B';
   [P,D,Q]=svd(Smat,0);
   fit=D(1,1)^2+D(2,2)^2;
   fit=fit/ssq(Smat)*100;
   Amat=(n/m)^.25*P(:,1:2)*D(1:2,1:2)^.5;
   Bmat=(m/n)^.25*Q(:,1:2)*D(1:2,1:2)^.5;
   min([Amat;Bmat]);xmin=min(ans)-.1;
   max([Amat;Bmat]);xmax=max(ans)+.1;
   axis([xmin xmax xmin xmax]);
   X=Amat;id=laba;   
   text(X(:,1),X(:,2),id,'FontSize',fs);
   X=Bmat;id=labb;
   text(X(:,1),X(:,2),id,'FontSize',fs);
end;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?