- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
#include <stdio.h>
#include <math.h>
double math_average (double values[2][3], int rows);
double dispers (double values[2][3], int rows);
void main() {
int rows = 2;
double values[2][3] = {(1,2),(2,4), (4,8)};
double av = math_average (values, rows);
double di = dispers (values, rows);
}
/* **********************************************
Srednee Arifmeticheskoe
@values[][0]: vremya otpravki paketa;
@values[][1]: vremya priema paketa
@values[][2]: raznitsa vremeni priema i otpravki
@rows: kolichestvo strok
********************************************** */
double math_average (double* values[2][3], int rows){
int count = rows;
double sum = 0;
while (count){
*values[count][2] = *values[count][0] - *values[count][1];
sum += *values[count][2];
count--;
}
return (sum / rows);
}
/* ***********************************
Dispersiya
D= sqrt (sum((sr_arifm - a[i])^2))
@values[][0]: vremya otpravki paketa;
@values[][1]: vremya priema paketa
@values[][2]: raznitsa vremeni priema i otpravki
@rows_sum: kolichestvo strok
*/
double dispers (double* values[2][3], int rows){
int count = rows;
double sum = 0;
double math_av = math_average(values, rows);
for (int i = 0; i < count; i++){
sum += pow((math_av - *values[i][2]), 2);
}
return (sqrt(sum));
}