/* nag_tsa_spectrum_bivar(g13cdc) Example Program. * * Copyright 1996 Numerical Algorithms Group. * * Mark 4, 1996. * */ #include #include #include #include #include #define L 80 #define KC 8*L #define NXYMAX 300 int main(void) { double x[KC], y[KC]; double pxy; double pw; Complex *g; Integer i, j, ng, is; Integer mw; Integer nxy; Integer kc=KC, l=L; Vprintf("g13cdc Example Program Results\n"); /* Skip heading in data file */ Vscanf("%*[^\n] "); Vscanf("%ld ", &nxy); if (nxy > 0 && nxy <= NXYMAX) { for (i = 1; i <= nxy; ++i) Vscanf("%lf ", &x[i - 1]); for (i = 1; i <= nxy; ++i) Vscanf("%lf ", &y[i - 1]); /* Set parameters for call to g13cdc */ /* Mean correction and 10 percent taper */ pxy = 0.1; /* Window shape parameter and zero covariance at lag 16 */ pw = 0.5; mw = 16; /* Alignment shift of 3 */ is = 3; g13cdc(nxy, Nag_Mean, pxy, mw, is, pw, l, kc, x, y, &g, &ng, NAGERR_DEFAULT); Vprintf("\n Returned sample spectrum\n"); Vprintf("\n Real Imaginary Real Imaginary " " Real Imaginary\n"); Vprintf(" part part part part " " part part\n\n"); for (j = 1; j <= ng; ++j) Vprintf("%5ld%8.4f%9.4f%s", j,a02bbc(g[j - 1]),a02bcc(g[j - 1]), (j%3==0 ? "\n" : "")); Vprintf("\n"); if (g) NAG_FREE(g); } return EXIT_SUCCESS; }