Мне нужно сделать PCA в Matlab для распознавания объектов.
На данный момент я генерирую матрицу случайным образом
[a,InputMatrix] = sort(rand(100,20)); %Rows=100 Columns=20
Average=mean(InputMatrix);
CovarianceMatrix= cov(InputMatrix);
%% Compute the Eigen Value and Eigen the Vector
[EigVector,EigValue] = eigs(Matlab_Covariance);
NewMatrix=(EigVector)*(EigValue)*(EigVector)';
e1=EigVector(:,1); % Get the all the row at the first column
e2=EigVector(:,2); % Get the all the row at the second column
%% Plotting The Matrix with Eigen Value and Eigen Vector
%creating all combinations of x and y coordinates
[x,y]=meshgrid(1:size(InputMatrix,2),1:size(InputMatrix,1)); % 2= Columns 1= Rows
x=x(:);
y=y(:);
%plotting values of A such that X-Y axis represent the column and row coordinates of A
%respectively. Z-axis represents the value at that coordinate.
scatter3(x,y,InputMatrix(:),30,'rx');
%plotting the mean at the center of the coordinate system
hold on;
scatter3(mean([1:size(InputMatrix,2)]),mean([1:size(InputMatrix,1)]),
mean2(InputMatrix),60,'go','filled');
plot(e1,'k--');
plot(e2,'k--');
Но если я выполню PCA в этой случайной матрице (InputMatrix), форма собственных векторов e1 и e2, которые я получу для результата PCA, будет неправильной (когда я нарисую их с помощью InputMatrix на том же рисунке).
Кто-то сказал мне, что для входной матрицы/данных она должна соответствовать условию (должна быть распределена по нормальному гауссовскому закону) и иметь форму эллипса (когда я ее рисую). Я думаю, мне нужно делать вращение, масштабирование и другие вещи, чтобы сделать это..
Но я не понимаю..
Может ли smeone помочь мне сгенерировать случайную матрицу с нормальным гауссовым и в форме эллипса ?? Пожалуйста.. помогите мне Т_Т