A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
K=1;
X = rand(5,2);
M = mean(X);
C = cov(X);
[U D]=eig(C);
L=diag(D);
[sorted index]=sort(L,'descend');
Xproj=zeros(d,K);
for j=1:K
Xproj(:,j)=U(:,index(j));
end
Y=X*Xproj;
plot(Y1,'d');
axis([4 24 -2 18]);
% Find the first K Principal Components of data X (n rows, d columns)
% X contains n pattern vectors with d features
X= [2.5,0.5,2.2,1.9,3.1,2.3,2.0,1.0,1.5,1.1];
Y= [2.4,0.7,2.9,2.2,3.0,2.7,1.6,1.1,1.6,0.9];
Data = [X;Y]';
mx = mean(X);
my = mean(Y);
Xadj = (X-mean(X));
Yadj = (Y-mean(Y));
DataAdj= [Xadj;Yadj];
Cadj = cov(Xadj,Yadj);
C = cov(X,Y);
[Uadj Dadj]=eig(Cadj);
[U D]=eig(C);
L=diag(D);
[sorted index]=sort(L,'descend');
[FVector index]=sort(U,'descend');
%Final data using both eigenvectors in U
ColAdjData = DataAdj';
FData = FVector * ColAdjData';
OriginalAdjustedData = FVector' * FData;
figure;
plot(X,Y, 'd');
axis equal;
axis([-2 5 -2 5])
figure;
plot(Xadj, Yadj, 'x');
axis([-2 2 -2 2])
figure;
plot(D,'*')
axis([-2 2 -2 2])
figure;
plot(Xadj, Yadj, 'x');
hold on
plot(D,'*')
axis([-2 2 -2 2])
figure;
plot(FData,'d')
axis([-2 2 -2 2])
figure;
plot(OriginalAdjustedData,'r*')
axis([-2 2 -2 2])
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.