-
Notifications
You must be signed in to change notification settings - Fork 1
Description
i am trying to do the exercise from the book where i face difficulties to understand the code. please check below, i mentioned which part i can't understand
!git clone https://github.com/UniprJRC/DSwithMATLAB.git
xtable = readtable("C:\Italy Education\2nd smtr\matlab\v1\DSwithMATLAB\matlabfilesuk\ch11PCA\SpesaFatt.xlsx")
data = xtable{:,:};
n=size(data,1); x1=data(:,1);x2=data(:,2);
meanData = mean(data)
xTilde = data - meanData
s= xTilde'*xTilde/(n-1) %coverience matrix
plot(x1,x2,'o','LineWidth',3)
xlabel('X1 = Advertising spend (millione)')
ylabel('X2 = Revenue (millione)')
hold('on')
confLevEllipses = [0.5 0.75 0.90 0.99]
for i=1:length(confLevEllipses)
ellipse(meanData,s,confLevEllipses(i))
end
axis equal
from this part i can't understand what is happening.
[Vini,Lambdaini] = eig(s);
[~,ord]=sort(diag(Lambdaini),'descend');
Lambda = Lambdaini(ord,ord);
V=Vini(:,ord)