home *** CD-ROM | disk | FTP | other *** search
- #include <math.h>
- #include <graph.h>
- #include "stdlib.h"
- #include "stdio.h"
- #include "miscio.h"
- #include "fft.h"
- #include "worlddr.h"
- #include "segraph.h"
-
-
- float xdata[512];
- float ydata[512];
- float tdata[512];
- int lower,upper,n,i,j,k;
- char c;
-
-
-
- void main()
- {
- n = 128;
- for (i= 0; i <= n; i++ )
- {
- xdata[i] = 6 * cos(M_PI*i/(19.0 +frandom())) + 2.5 *cos(M_PI*i/32.0 );
- ydata[i] = 0.0;
- tdata[i] = i;
- }
-
- /****************************************************
- - IF YOU WANT TO CONFIGURE FOR CGA 4 COLORS
- CHOOSE InitSEGraphics(1);
- - HERCULES SUPPORT IS NOW INCLUDED IN MICROSOFT
- C VERSION 5.1. IF YOU WANT TO USE THE
- HERCULES DRIVER YOU MUST FIRST INSTALL
- MSHERC.COM FROM DOS BY TYPING
- msherc<enter>
- THEN IN YOUR MAIN PROGRAM CALL
- InitSEGraphics(12);
- - REFER TO THE README.DOC FILE - PART 3
- INCLUDED IN YOUR MICROSOFT C 5.1 COMPILER
- FOR DETAILS ON ADDED HERCULES SUPPORT.
- **************************************************/
-
- InitSEGraphics(6);
-
- SetCurrentWindow(3);
- ClearWindow();
- SetAxesType(0,0);
- SelectColor(15);
- AutoAxes(tdata,xdata,n,0);
- LinePlotData(tdata, xdata, n,3, 1);
- SelectColor(15);
- TitleWindow("Original data");
-
-
-
- FFTCalc(xdata,ydata,n);
-
-
- SetCurrentWindow(4);
- SelectColor(15);
- SetAxesType(0,0);
- AutoAxes(tdata,xdata,n/2,0);
- LinePlotData(tdata, xdata, n/2,2, 1);
- TitleWindow("FFT Data");
-
- c = getch();
- CloseSEGraphics();
- }
-
-
-