diff --git a/ТЕМА2/Progl.m b/ТЕМА2/Progl.m index be959c6..6bf8c7b 100644 --- a/ТЕМА2/Progl.m +++ b/ТЕМА2/Progl.m @@ -1,22 +1,38 @@ -XX=load('dan_vuz.txt') -size(XX) -X=XX(:,3:13) -R = corr(X) -[vect,lambda]=eig(X'*X) -Sobst=diag(lambda) -fprintf('Eigenvalues:\n%f\n', Sobst) -fprintf('\n') -SobMax = Sobst(end) -GlComp = vect(:, end) -Delt = 100*SobMax/sum(Sobst) -fprintf('Delta=%d\n', round(Delt)) -Res = X * GlComp -fprintf('Results\n') -fprintf('%d %f \n', [XX(:, 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('Correlation of Results and Money = %f\n', CorFin) +fp = fopen('prtcl.txt', 'w'); +if fp == -1 + error('Не удалось открыть файл prtcl.txt для записи!'); +endif +XX=load('dan_vuz.txt'); +size(XX); +fprintf(fp, 'Size of XX: %s\n', mat2str(size(XX))); +X=XX(:,3:13); +R = corr(X); +[vect,lambda]=eig(X'*X); +Sobst=diag(lambda); +fprintf(fp, 'Eigenvalues:\n'); +fprintf('Eigenvalue:\n'); +for i = 1:length(Sobst) + fprintf(fp, '%f\n', Sobst(i)); + fprintf('%f\n', Sobst(i)); +end +fprintf(fp, '\n'); +fprintf('\n'); +SobMax = Sobst(end); +GlComp = vect(:, end); +Delt = 100*SobMax/sum(Sobst); +fprintf(fp, 'Delta=%d\n', round(Delt)); +fprintf('Delta=%d\n', round(Delt)); +Res = X * GlComp; +fprintf(fp,'Results\n'); +for i = 1:size(XX, 1) + fprintf(fp, '%d %f \n', [XX(i, 1), Res(i)]'); + fprintf('%d %f \n', [XX(i, 1), Res(i)]'); + end +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); +fprintf('Correlation of Results and Money = %f\n', CorFin); diff --git a/ТЕМА2/prtcl b/ТЕМА2/prtcl new file mode 100644 index 0000000..e69de29 diff --git a/ТЕМА2/prtcl.txt b/ТЕМА2/prtcl.txt new file mode 100644 index 0000000..354e411 --- /dev/null +++ b/ТЕМА2/prtcl.txt @@ -0,0 +1,284 @@ +Size of XX: [290 15] +Eigenvalues: +22.946585 +1931.665464 +2593.979592 +3457.339562 +5625.151474 +8672.065947 +18914.627989 +47522.678185 +57483.681267 +225653.068540 +7494628.795394 + +Delta=95 +Results +197 92.541636 +198 73.432513 +199 5.885468 +200 35.300393 +201 70.208100 +202 28.096191 +203 87.136298 +204 79.776499 +205 36.243011 +206 18.249808 +207 49.666520 +208 45.067095 +209 81.785392 +210 5.555862 +211 105.361366 +212 4.575460 +213 381.204021 +214 26.712747 +216 8.037618 +217 119.627795 +218 10.061485 +219 63.762947 +220 9.087658 +221 41.684105 +222 35.907417 +223 76.139589 +224 23.752550 +225 142.216169 +226 67.755801 +227 20.597788 +228 76.818771 +229 104.284923 +230 18.541601 +231 4.473983 +232 3.580878 +233 224.758597 +234 26.863645 +235 212.911324 +236 50.921549 +237 33.628254 +238 42.168327 +239 103.701129 +240 136.060809 +241 713.711764 +242 34.027235 +245 4.102289 +246 27.086730 +247 2.667541 +248 2.497556 +252 103.829221 +253 7.460715 +256 34.755449 +257 4.359736 +258 5.741187 +259 15.989432 +261 45.399798 +264 2.462250 +267 6.424390 +268 66.503024 +273 73.935542 +275 11.130530 +296 3.684256 +304 9.970486 +305 28.031419 +311 1.352414 +318 40.905330 +322 11.722703 +325 30.793455 +326 42.716264 +329 10.023429 +330 32.260491 +334 25.495269 +335 36.870098 +336 42.948416 +339 87.963238 +340 228.668981 +341 99.146097 +342 28.749899 +343 9.622160 +346 1.359974 +347 54.213640 +348 107.547742 +349 116.106427 +352 299.102890 +356 14.333164 +357 20.479493 +362 144.908794 +365 14.952535 +366 25.976099 +371 268.149429 +372 12.353605 +373 4.526119 +376 104.664655 +377 91.264814 +379 209.329940 +381 196.452926 +383 4.812125 +387 1.387719 +388 50.732954 +389 118.633179 +391 212.528679 +392 37.744725 +393 30.102473 +394 320.669960 +395 0.000000 +399 41.450044 +410 141.123026 +412 405.347359 +413 12.875247 +414 117.612150 +441 8.989886 +446 74.655250 +448 89.566395 +451 37.992598 +456 40.599701 +465 37.339465 +466 142.928780 +467 9.122607 +472 53.463843 +476 93.289532 +477 57.155319 +484 19.139209 +1001 5.491474 +1002 85.213352 +1004 170.642969 +1017 90.453986 +1030 57.810669 +1034 7.372961 +1035 9.614944 +1037 1.846687 +1038 17.646937 +1039 153.910670 +1041 119.835954 +1044 5.010210 +1 2.691959 +2 379.300890 +3 13.497203 +4 2.462250 +6 19.718182 +7 200.667783 +8 93.618235 +9 25.650544 +10 26.344823 +11 65.285854 +12 21.514761 +13 176.510003 +14 1898.884523 +15 91.241365 +16 304.552394 +17 6.355976 +18 3.439437 +19 158.859588 +20 187.802059 +21 26.561371 +22 8.657907 +23 110.316703 +26 21.286647 +28 8.028500 +29 76.976887 +33 148.320170 +34 97.178361 +35 6.713123 +36 88.631285 +37 333.404629 +38 27.838269 +40 11.662869 +41 0.000000 +42 71.250154 +43 0.369757 +44 10.360736 +45 3.855089 +51 81.568715 +52 54.636552 +53 23.501931 +54 90.446620 +55 57.162095 +56 162.850196 +57 305.874565 +58 6.323299 +59 59.415851 +60 46.966205 +62 56.660855 +63 815.675312 +64 47.723188 +65 277.021471 +66 328.086215 +67 113.590454 +68 11.709047 +69 33.969900 +71 0.913379 +72 122.671912 +73 59.978744 +74 7.491057 +75 12.504248 +76 24.208529 +77 400.110964 +78 263.576362 +79 25.930889 +80 36.895259 +81 254.783774 +82 6.870138 +84 12.625935 +85 23.783568 +86 3.159890 +87 5.151827 +88 0.000000 +89 106.765711 +90 15.783445 +91 30.701284 +92 64.989933 +93 43.087958 +94 31.124285 +95 5.171761 +96 48.085148 +97 5.347890 +99 2.124571 +100 0.082078 +101 21.635603 +102 52.057076 +103 25.625192 +104 9.750228 +105 36.202865 +107 4.626653 +108 3.190574 +109 9.578291 +110 6.374896 +111 3.684453 +112 5.784829 +113 8.236760 +114 6.872598 +115 41.304826 +116 1.988474 +118 7.571316 +119 1.231125 +120 5.081094 +121 21.547440 +122 30.299927 +123 45.503740 +124 9.093912 +132 10.369658 +133 7.125935 +134 14.133228 +135 26.102416 +136 5.071976 +137 12.085286 +138 0.713469 +139 0.675086 +140 4.092547 +141 7.454102 +142 184.663991 +143 10.455368 +144 7.448129 +146 6.242521 +147 8.860180 +148 39.991951 +149 6.891026 +150 5.160709 +151 15.489599 +152 5.590467 +153 27.378151 +154 10.801195 +162 23.750968 +166 11.426264 +167 8.473236 +168 6.898371 +170 3.416283 +171 208.746883 +172 12 \ No newline at end of file diff --git a/ТЕМА2/res.mat b/ТЕМА2/res.mat index 572e4b2..4834c44 100644 Binary files a/ТЕМА2/res.mat and b/ТЕМА2/res.mat differ