// file: ./examples/example_01.cc // // isip include files // #include // main program starts here // int main(int argc, const char **argv) { // declare a Spectrum object and an output vector // Spectrum spectrum; VectorFloat output; // generate 3 ms sine wave of frequency 1000Hz // long sample_freq = 8000; long num_samples = 240; // create the input sampled data // VectorFloat input(num_samples); double step = Integral::TWO_PI * 1000.0 / (double)sample_freq; input.ramp(0, step); input.sin(); // set algorithm and implementation // spectrum.setAlgorithm(Spectrum::FOURIER); spectrum.setImplementation(Spectrum::MAGNITUDE); // set the algorithm, implementation and order of the underlying // FourierTransform object // spectrum.setFtAlgorithm(FourierTransform::FFT); spectrum.setFtImplementation(FourierTransform::SPLIT_RADIX); spectrum.setFtOrder((long)256); // compute the spectrum of input data // spectrum.compute(output, input); // output the input, the spectrum object and the output // magnitude-spectrum to the console // input.debug(L"input"); spectrum.debug(L"spectrum"); output.debug(L"output"); // exit gracefully // Integral::exit(); }