There are some steps for implementing Principal
Component Analysis. They are:-
Step-1-Take an original data set and calculate mean of the
data set taking as column vectors, each of which has M rows.
Place the column vectors into a single matrix X of dimensions
M × N.
Step-2-Subtract off the mean for each dimension. Find the
empirical mean along each dimension m = 1... M of each
column. Place the calculated mean values into an empirical
mean vector u of dimensions M × 1.
N
u [m]=(1/N)ΣX [m, n] n=1