Експоненціальна залежність
Текст програми 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 "exponenta" 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 + LOG(Y(I)) LET S4 = S4 + X(I) * X(I) LET S5 = S5 + X(I) * LOG(Y(I)) NEXT I LET B = (S2 * S3 - S1 * S5) / (S2 ^ 2 - S1 * S4) LET A = EXP((1 / S1) * (S3 - B * S2)) PRINT "Y="; A; "* exp^"; B; "*X" LET S = 0 FOR I = 1 TO N LET S = S + (Y(I) - (A * EXP(B * X(I)))) ^ 2 NEXT I LET S = SQR(S / (N - 2)) PRINT "Seredne kvadratychne vidhylennia", USING "###.######"; S OPEN "expon.dat" FOR OUTPUT AS #1 PRINT #1, "exponentna zalejnist" PRINT #1, "Y="; A; "* exp^"; 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 * EXP(B * X(I)) NEXT I CLOSE #1 END Результати exponentna zalejnist Y= 57.2406 * exp^ 6.395973E-03 *X Seredne kvadratychne vidhylennia 2.292774 X Y Yr 0,1 54,1 57,27722 10 60,1 61,02131 20 66,1 65,05173 30 71,2 69,34837 40 76,1 73,92879 50 80,8 78,81175 60 85,7 84,01723 70 90,6 89,56652 80 95,6 95,48234 90 99,8 101,7889 100 104,6 108,512 Графік
|