Трябва да направя 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 да ми помогне да генерирам произволна матрица с нормален Гаус и във форма на елипса?? Моля.. помогнете ми T_T