Files
it-labs/ТЕМА2/Progl.m
2026-02-12 11:46:03 +03:00

25 строки
617 B
Matlab

fp = fopen('prtcl.txt', 'w');
XX=load('dan_vuz.txt');
size(XX);
X=XX(:,3:13);
R = corr(X);
[vect,lambda]=eig(X'*X);
Sobst=diag(lambda);
fprintf(fp, 'Eigenvalues:\n %f \n', Sobst);
fprintf(fp, '\n');
SobMax = Sobst(end);
GlComp = vect(:, end);
Delt = 100*SobMax/sum(Sobst);
fprintf(fp, 'Delta=%d\n', round(Delt));
Res = X * GlComp;
fprintf(fp,'Results \n');
fprintf(fp, '%d %f \n', [XX(i, 1), Res] );
save res.mat Res -mat;
hist(Res, 20);
xlabel('Results');
ylabel('Number of Unis');
saveas(gcf,'Hist.jpg','jpg');
CorFin = corr(Res, XX(:,2));
fprintf(fp, 'Correlation of Results and Money = %f\n', CorFin);
fclose(fp)