Вихідні дані.
Розрахункова частина Лінійна залежність Текст програми CLS REM MNK DIM X(50), Y(50) INPUT "Vvedit kilkist doslidiv N "; N FOR I = 1 TO N PRINT "Vvedit "; I; "znachennia X,Y" INPUT X(I), Y(I) NEXT I PRINT "liniyna" LET S1 = N: LET S2 = 0: LET S3 = 0 LET S4 = 0: LET S5 = 0 FOR I = 1 TO N LET S2 = S2 + X(I): LET S3 = S3 + Y(I) LET S4 = S4 + X(I) * X(I) LET S5 = S5 + X(I) * Y(I) NEXT I LET B = (S2 * S3 - S1 * S5) / (S2 * S2 - S1 * S4) LET A = (1 / S1) * (S3 - B * S2) PRINT "Y="; A; "+"; B; "*X" LET S = 0 FOR I = 1 TO N LET S = S + (Y(I) - (A + B * X(I))) ^ 2 NEXT I LET S = SQR(S / (N - 2)) PRINT "Seredne kvadratychne vidhylennia", USING "###.######"; S OPEN "linear.dat" FOR OUTPUT AS #1 PRINT #1, "liniyna zalejnist" PRINT #1, "Y="; A; "+"; B; "*X" PRINT #1, "Seredne kvadratychne vidhylennia", USING "###.######"; S PRINT #1, "X", "Y", "Yr" FOR I = 1 TO N PRINT #1, X(I), Y(I), A + B * X(I) NEXT I CLOSE #1 END Результати liniyna zalejnist Y= 55.49384 +.4985778 *X Seredne kvadratychne vidhylennia 0.732921
X Y Yr 0,1 54,1 55,5437 10 60,1 60,47962 20 66,1 65,46539 30 71,2 70,45117 40 76,1 75,43695 50 80,8 80,42273 60 85,7 85,40851 70 90,6 90,39429 80 95,6 95,38007 90 99,8 100,3658 100 104,6 105,3516
Графік
|