blob: 779ffa0f407b260051d72f39b0a70dab7a912e8d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "moment.h"
double dmoments (double* inp, int size, double ord)
{
double sum = 0;
for(int i = 0; i < size; i++) // Elements are raised to the order and then their mean is calculated to give moment
{
sum = sum + pow(inp[i], ord);
}
return sum/size;
}
|