#include #include #include #include extern "C" { __declspec(dllexport) void vc_avar( double y[], int n, double tau0, double tau[], double ADEV[], double MDEV[], double TDEV[], int *N){ // function vc_avar : computes the ALLAN VARIANCE // INPUTS : // y = pointer to data, already allocated, length = n // n = length of data // tau0 = sampling periode in seconds // OUTPUTS : // tau = pointer to tau , already allocated, length >= N // ADEV = pointer to overlapped Allan STD DEV, already allocated , length >= N // MDEV = pointer to modified Allan STD DEV, already allocated , length >=N // TDEV = pointer to Time Allan STD DEV, already allocated , length >= N // N = length of results tau, ADEV, MDEV and TDEV. // // Copyright Alaa MAKDISSI 2003 // free for personal use only. int k; double *D; int m; double s,v,u; *N=floor(1+ log((n-1.0)/3.0)/log(2.0) ); // nb of points for the results //*N = 2; m=1; // m = 2^j ; j=0 ==> tau=tau0 D= new double [n]; for (int j=0; j<*N;j++) { tau[j]=m*tau0; s=0; v=0; //s =Y(0) and v =Y(m) for (k=0;k