home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************
- * Copyright (C) 1994 Charles P. Peterson *
- * 4007 Enchanted Sun, San Antonio, Texas 78244-1254 *
- * Email: Charles_P_Peterson@fcircus.sat.tx.us *
- * *
- * This is free software with NO WARRANTY. *
- * See gfft.c, or run program itself, for details. *
- * Support is available for a fee. *
- ***************************************************************************
- *
- * Program: gfft--General FFT analysis
- * File: okwritec.c
- * Purpose: Write the (complex) results of an fft analysis
- * Author: Charles Peterson (CPP)
- * History: 23-August-1993 CPP; Created.
- * Comment:
- */
-
- #include <stdio.h>
- #include <math.h>
- #include "gfft.h"
- #include "settings.h" /* Rate */
-
- void ok_writec (float *data, unsigned long data_count)
- {
- double frequency;
- double nyquist_frequency = Rate / 2.0L;
- double scaled_frequency = 2.0L * nyquist_frequency / data_count;
- int i;
-
- if (data_count > 0)
- {
- fprintf (WritePtr, "%-20.12g %-20.12g %-20.12g\n",
- 0.0L, data[0], 0.0L);
- }
-
- for (i = 2; i < data_count; i += 2)
- {
- frequency = scaled_frequency * (i / 2);
- fprintf (WritePtr, "%-20.12g %-20.12g %-20.12g\n",
- frequency, data[i], data[i+1]);
- }
- if (data_count > 1)
- {
- fprintf (WritePtr, "%-20.12g %-20.12g %-20.12g\n",
- nyquist_frequency, data[1], 0.0L);
- }
- }
-
-
-
-