www.gusucode.com > stats 源码程序 matlab案例代码 > stats/ProcrustesAnalysisExample.m
%% Procrustes Analysis %% % Generate the sample data in two dimensions. % Copyright 2015 The MathWorks, Inc. rng('default') n = 10; X = normrnd(0,1,[n 2]); %% % Rotate, scale, translate, and add some noise to sample points. S = [0.5 -sqrt(3)/2; sqrt(3)/2 0.5]; Y = normrnd(0.5*X*S+2,0.05,n,2); %% % Conform |Y| to |X| using procrustes analysis. [d,Z,tr] = procrustes(X,Y); %% % Plot the original |X| and |Y| with the transformed |Y| . plot(X(:,1),X(:,2),'rx',Y(:,1),Y(:,2),'b.',Z(:,1),Z(:,2),'bx');