d = procrustes(X,Y)
[d,Z] = procrustes(X,Y)
[d,Z,transform] = procrustes(X,Y)
[...] = procrustes(...,'scaling',flag)
[...] = procrustes(...,'reflection',flag)
d = procrustes(X,Y) determines a linear transformation (translation, reflection, orthogonal rotation, and scaling) of the points in matrix Y to best conform them to the points in matrix X. The goodness-of-fit criterion is the sum of squared errors. procrustes returns the minimized value of this dissimilarity measure in d. d is standardized by a measure of the scale of X, given by:
That is, the sum of squared elements of a centered version of X. However, if X comprises repetitions of the same point, the sum of squared errors is not standardized.
X and Y must have the same number of points (rows), and procrustes matches Y(i) to X(i). Points in Y can have smaller dimension (number of columns) than those in X. In this case, procrustes adds columns of zeros to Y as necessary.
c — Translation component
T — Orthogonal rotation and reflection component
b — Scale component
c = transform.c; T = transform.T; b = transform.b; Z = b*Y*T + c;
[...] = procrustes(...,'reflection',flag), when flag is false, allows you to compute the transformation without a reflection component (that is, with det(T) equal to 1). The default flag is 'best', which computes the best-fitting transformation, whether or not it includes a reflection component. A flag of true forces the transformation to be computed with a reflection component (that is, with det(T) equal to -1)
Generate the sample data in two dimensions.
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 .
 Kendall, David G. "A Survey of the Statistical Theory of Shape." Statistical Science. Vol. 4, No. 2, 1989, pp. 87–99.
 Bookstein, Fred L. Morphometric Tools for Landmark Data. Cambridge, UK: Cambridge University Press, 1991.
 Seber, G. A. F. Multivariate Observations. Hoboken, NJ: John Wiley & Sons, Inc., 1984.