summaryrefslogtreecommitdiff
path: root/2.3-1/src/c/statisticsFunctions/moment/zmoments.c
blob: b70df7073ff8528fc9523453ea97b3fb3b7259c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "moment.h"
#include "doubleComplex.h"
#include "floatComplex.h"
#include "pow.h"
#include "addition.h"
#include "division.h"


doubleComplex zmoments (doubleComplex* inp, int size, double ord)
{
    doubleComplex sum = DoubleComplex(0,0);

    for(int i = 0; i < size; i++)			// Elements are raised to the order and then their mean is calculated to give moment
    {
        sum = zadds(sum,zpows(inp[i], ord));
    }

    return zrdivs(sum,size);
}